From: "Gaëtan Rivet" <gaetan.rivet@6wind.com>
To: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] eal: fix build with gcc 4.7
Date: Mon, 16 Jul 2018 22:52:23 +0200 [thread overview]
Message-ID: <20180716205223.otemie3e2o3lytg4@bidouze.vm.6wind.com> (raw)
In-Reply-To: <20180716062627.29814-1-pablo.de.lara.guarch@intel.com>
Hi Pablo,
On Mon, Jul 16, 2018 at 07:26:27AM +0100, Pablo de Lara wrote:
> Fixed possible out-of-bounds issue:
>
> lib/librte_eal/common/eal_common_devargs.c:
> In function ‘rte_devargs_layers_parse’:
> lib/librte_eal/common/eal_common_devargs.c:121:7:
> error: array subscript is above array bounds
>
> Bugzilla ID: 71
> Fixes: 338327d731e6 ("devargs: add function to parse device layers")
>
Thanks for fixing this.
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> ---
> lib/librte_eal/common/eal_common_devargs.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c
> index a22a2002e..1a7b00ece 100644
> --- a/lib/librte_eal/common/eal_common_devargs.c
> +++ b/lib/librte_eal/common/eal_common_devargs.c
> @@ -118,12 +118,17 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
> }
>
> while (s != NULL) {
> - if (strncmp(layers[i].key, s,
> - strlen(layers[i].key)) &&
> - /* The last layer is free-form.
> - * The "driver" key is not required (but accepted).
> - */
> - i != RTE_DIM(layers) - 1)
> + if (i >= RTE_DIM(layers)) {
> + RTE_LOG(ERR, EAL, "Unrecognized layer %s\n", s);
> + ret = -EINVAL;
> + goto get_out;
> + }
> + /*
> + * The last layer is free-form.
> + * The "driver" key is not required (but accepted).
> + */
> + if (strncmp(layers[i].key, s, strlen(layers[i].key)) &&
> + i != RTE_DIM(layers) - 1)
> goto next_layer;
> layers[i].str = s;
> layers[i].kvlist = rte_kvargs_parse_delim(s, NULL, "/");
> @@ -136,11 +141,6 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
> if (s != NULL)
> s++;
> next_layer:
> - if (i >= RTE_DIM(layers)) {
> - RTE_LOG(ERR, EAL, "Unrecognized layer %s\n", s);
> - ret = -EINVAL;
> - goto get_out;
> - }
> i++;
> }
>
> --
> 2.14.4
>
--
Gaëtan Rivet
6WIND
next prev parent reply other threads:[~2018-07-16 20:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-16 6:26 Pablo de Lara
2018-07-16 20:52 ` Gaëtan Rivet [this message]
2018-07-18 9:02 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180716205223.otemie3e2o3lytg4@bidouze.vm.6wind.com \
--to=gaetan.rivet@6wind.com \
--cc=dev@dpdk.org \
--cc=pablo.de.lara.guarch@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).