From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 583071B4EA; Fri, 23 Nov 2018 11:45:50 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C817621FBA; Fri, 23 Nov 2018 05:45:48 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 23 Nov 2018 05:45:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=nWAHOmzXpAZcQSTfhu8tlDSf+eMZiyJOLDIEomP+YE0=; b=qZeWttfSHbtm n99I5ouNX/TJ1J11wWYmz1W1OoKN+GvYzZHC3b0sRT0BwtOHFDkrsQP011Vh+jNh kDj9uCvvx6IeRRT+SkCq9VOHmv+vuIw/fOl3ZbSw0/BLYwjW8N+fa1w7hVkFJ/AA dD3jvcDPZ+MWumI6oQbS/tx6EpNAuR0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=nWAHOmzXpAZcQSTfhu8tlDSf+eMZiyJOLDIEomP+Y E0=; b=ZCJkm3J1BUIvDlnKBqGsPxJGye9E8oxk0MJrClC1gUEZFNaPJGuWTLiBa i/hCK19W4d0HFlf9ZR53vIQh7gR3udg4q6gmj6xaWQ99s3eKwOsmZ8TLOqfiMJ9N xWMOYGZFx+ELcAlPSN/6jESXaRV7pNo5EWJwu7Dfsyr9ViWTbliYLiksEyFheHyS DCL+dyplbwGQOKRPmXoEKL5uY7lEW68Pl/kP1Pus+zHxglh1/SjHgVvKveqJPQEl xzQCxBTjf8m1JDkhWGf6wwnmq/vaKDxv+jrOlgsY2Sur3IFB+CwZp9AayvO8TQbx HuHAWPOhtcCbXZ5eEukwRA9+TwNVA== X-ME-Sender: X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 4CF08102EA; Fri, 23 Nov 2018 05:45:47 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: Ferruh Yigit , stable@dpdk.org, Stephen Hemminger , gaetan.rivet@6wind.com, arybchenko@solarflare.com Date: Fri, 23 Nov 2018 11:45:44 +0100 Message-ID: <1550603.EXdslK9Pks@xps> In-Reply-To: <20181123002945.36697-1-ferruh.yigit@intel.com> References: <20181106214901.1392-2-stephen@networkplumber.org> <20181123002945.36697-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] bus/pci: fix allocation of PCI device path X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2018 10:45:50 -0000 Please, anyone for a review and a test? 23/11/2018 01:29, Ferruh Yigit: > The pci_resource_by_index called strlen() on uninitialized > memory which would lead to the wrong size of memory allocated > for the path portion of the resource map. This would either cause > excessively large allocation, or worse memory corruption. > > Coverity Issue: 300868 > Fixes: ea9d56226e72 ("pci: introduce function to map uio resource by index") > Cc: stable@dpdk.org > > Signed-off-by: Stephen Hemminger > Signed-off-by: Ferruh Yigit > --- > drivers/bus/pci/linux/pci_uio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c > index a7c14421a..09ecbb7aa 100644 > --- a/drivers/bus/pci/linux/pci_uio.c > +++ b/drivers/bus/pci/linux/pci_uio.c > @@ -296,7 +296,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, > maps = uio_res->maps; > > /* allocate memory to keep path */ > - maps[map_idx].path = rte_malloc(NULL, strlen(devname) + 1, 0); > + maps[map_idx].path = rte_malloc(NULL, sizeof(devname), 0); > if (maps[map_idx].path == NULL) { > RTE_LOG(ERR, EAL, "Cannot allocate memory for path: %s\n", > strerror(errno)); >