From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id 8207C201 for ; Mon, 16 Jul 2018 22:52:41 +0200 (CEST) Received: by mail-wr1-f68.google.com with SMTP id g6-v6so24322038wrp.0 for ; Mon, 16 Jul 2018 13:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=9TYzeulkSO/S94D8IziUwtjK9NzRTnlJbmfLga2YarY=; b=bakWkR9ww4pjYBYEAc5ILo5PoIVINb8SPABf8OtKQ9eUVrw3NVisByNJuU7rWUVkts BrDQMNMd6Ed5RqfKJaE0h/r5soPpiGawSdid5sTzECzQDM9k7qLn9U9tTFg4ga6dytg5 y3VLN0ui2Mn5Qi2hyzzyK0GvyvJ59EoPBLtRH0LC/A2rGIPaqbzpahtNvnf8HFSm/eYD gA9gliWfOhAvhMjKFpBoRj4bZPDQawGE4RzxcDldYeLi+mYYZF+mK0UfIcd1ExuvAurk KReLs2T83ZTRtVT7Xohl2d7lNnbjhBx4XOKQEwbi9HIqWP6STsFwATqg3kL07IRdHkii j8ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=9TYzeulkSO/S94D8IziUwtjK9NzRTnlJbmfLga2YarY=; b=a9p2hhG4ujKwb7NypVMys1VD0Va2G6KprKkAmodClsBN3G7kBmOLYnppzQNS7DT1Yc d0AFYhhfsHayc7h2vaN5GN8hYmCmDTkElWGKpI7rOHu3OApFPEeGaxNEhI0AN+ITZG4/ /fJJ/k9O7MWgoZ0xNFXso9nJ9R6FzbdXV3aTNN1AolDKDMOYZQTDk0Tjkjz2C74kIDDk 37tXkOdUd7Yq5DdkpMuNe7yEs8DVe7l1ehQdqtxzy4Cpy5007eroyN/jFPgGXj64pEhN wvlkbTl+EZkPndByqwBDLXRuqfk85X48e7AWmsspacWV48IcHCKwr9gb5QiKKiiq3EYd b/hQ== X-Gm-Message-State: AOUpUlGo6b78xFjGNe/+MaFuYM/rBcHYV1xft7oV6bH1yLU502ra4hmY kip29KFr8mlAJ2b9mqSDu1srCw== X-Google-Smtp-Source: AAOMgpfT2k0damyelBxYG+5JlKJ/pk8l5iN33WY8tJ7JK8AlZ5NcQNCwVg8Stnl1n2zVTHW3Sk7epQ== X-Received: by 2002:adf:9a0b:: with SMTP id z11-v6mr12754797wrb.47.1531774361023; Mon, 16 Jul 2018 13:52:41 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id t1-v6sm16440550wmt.40.2018.07.16.13.52.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 13:52:40 -0700 (PDT) Date: Mon, 16 Jul 2018 22:52:23 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Pablo de Lara Cc: dev@dpdk.org Message-ID: <20180716205223.otemie3e2o3lytg4@bidouze.vm.6wind.com> References: <20180716062627.29814-1-pablo.de.lara.guarch@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180716062627.29814-1-pablo.de.lara.guarch@intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH] eal: fix build with gcc 4.7 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2018 20:52:41 -0000 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 Acked-by: Gaetan Rivet > --- > 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