From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 560A5A0679 for ; Wed, 3 Apr 2019 18:27:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 19E851B4BD; Wed, 3 Apr 2019 18:27:55 +0200 (CEST) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 10D561B443; Wed, 3 Apr 2019 18:27:54 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id A051C220F7; Wed, 3 Apr 2019 12:27:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 03 Apr 2019 12:27:53 -0400 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=bH6sfpjFiUOJoTFNZSNDKQyCGXptZeupZ4MHnf/020M=; b=W6qgIjqda+x0 O8GZC3pRO8Pm1zfGYInWbVk2Oh+wKGJr6Up6H5urenzAm9c/UtwboMnsz5uvPXXg GHlj4ECqhC2fFDQYkMtT2xONONspkWKg6L6xdPLHAfqOGnff4v1JmNMpTUB8sa1u MoZ1CSEasCDZTQ+4x2TnJ8n5mslFPhs= 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=fm2; bh=bH6sfpjFiUOJoTFNZSNDKQyCGXptZeupZ4MHnf/02 0M=; b=afh35yItFqXPHQBRHCAyTPGa1kvBhBxUG6Q63xOKojcCrIWeGwwgMf+k+ A2gUvwtx+KklopTgBmxKWcwwDIyrOsrMMubGV4SLjRWnIY+nXdyX3rJPnwZifwUs MdxoeLtvy974EusLUKL+1bCbQoOCf/VbkDgiGURe1TIzQYF3rhMvEuN0plNfVE7e 3tRZSsRkwoVPoENV4MNAkCi2Ggd6pRFrk36TOucBvoxwSnNrCc0Xp3nn6WvolSfA ydiW0/SgM9KGaMXnpQlsiHaLEpJ/VQEwrsBSrh4VcRlTAJgQ1GjUFi7kKfW7ebk4 P5+WZ5rZ9KEhL/tbFFJRFo2g7L3Gw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrtdefgdejheculddtuddrgedutddrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvffufffkjghfggfgtgesthfuredttddtvden ucfhrhhomhepvfhhohhmrghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrg hlohhnrdhnvghtqeenucfkphepjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhep mhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsth gvrhfuihiivgeptd 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 6BF131030F; Wed, 3 Apr 2019 12:27:52 -0400 (EDT) From: Thomas Monjalon To: Mohammad Abdul Awal Cc: dev@dpdk.org, ferruh.yigit@intel.com, arybchenko@solarflare.com, stable@dpdk.org Date: Wed, 03 Apr 2019 18:27:51 +0200 Message-ID: <1807422.QXMQecOh3y@xps> In-Reply-To: <20190403160726.1231-1-mohammad.abdul.awal@intel.com> References: <20190403160726.1231-1-mohammad.abdul.awal@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 1/3] ethdev: fix null pointer checking 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190403162751.8gDBnz5cXiWM7re6apxH1OghuteAA2cHHxYwwsG4bSM@z> 03/04/2019 18:07, Mohammad Abdul Awal: > Null value for parameter name will cause segfault for the > strnlen and strcmp functions. I'm not sure we want such obvious checks for all APIs. Here I would say yes. > Fixes: 0b33b68d12 ("ethdev: export allocate function") > Fixes: 942661004c ("ethdev: export secondary attach function") > Cc: stable@dpdk.org > > Signed-off-by: Mohammad Abdul Awal > --- > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -440,6 +440,11 @@ rte_eth_dev_allocate(const char *name) > struct rte_eth_dev *eth_dev = NULL; > size_t name_len; > > + if (name == NULL) { > + RTE_ETHDEV_LOG(ERR, "Null pointer is specified\n"); This is a very generic error message. It might be "Fail to allocate port with empty name" > @@ -492,6 +497,11 @@ rte_eth_dev_attach_secondary(const char *name) > uint16_t i; > struct rte_eth_dev *eth_dev = NULL; > > + if (name == NULL) { > + RTE_ETHDEV_LOG(ERR, "Null pointer is specified\n"); "Fail to attach port with empty name"