From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH 1/3] ethdev: fix null pointer checking Date: Wed, 3 Apr 2019 11:50:32 -0700 Message-ID: <20190403115032.492e1c57@shemminger-XPS-13-9360> References: <20190403160726.1231-1-mohammad.abdul.awal@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com, stable@dpdk.org To: Mohammad Abdul Awal Return-path: Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 279B91B535 for ; Wed, 3 Apr 2019 20:50:36 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id c8so19366pfd.10 for ; Wed, 03 Apr 2019 11:50:36 -0700 (PDT) In-Reply-To: <20190403160726.1231-1-mohammad.abdul.awal@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, 3 Apr 2019 17:07:26 +0100 Mohammad Abdul Awal wrote: > Null value for parameter name will cause segfault for the > strnlen and strcmp functions. > > Fixes: 0b33b68d12 ("ethdev: export allocate function") > Fixes: 942661004c ("ethdev: export secondary attach function") > Cc: stable@dpdk.org > > Signed-off-by: Mohammad Abdul Awal > --- > lib/librte_ethdev/rte_ethdev.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c > index 10bdfb37e..26898ed08 100644 > --- 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"); > + return NULL; > + } > + Ok, but I doubt that a driver that is so buggy that it passes NULL that it will do any proper error handling on return of NULL. Would rather just see the application crash hard immediately.