From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aU3PsApVk31hTVf1jMdACWjudMTcKj7eONyAYkYoSk8=; b=Yp+oSb8der08KAg+RlFrzvM37FhyrfSIFA9v0U/IbzKOQW35tjEUUY+txUa9FQ91Ig DMeaVj0Gt2o8dvOCcwCOjvB0GPepjTTZmsI3e+ccduKS7alXWBSdUT3akFh3v9hW65Ul 2ghPD/JIVFDtfOGlSRamaPPqkUEwzIcDkG9ghBMFrBcB4Mm26B+SlPoi+//U3QYlP7is rSB7ISBAC8+qpX/QRomqPguV+d6527u75AfRMcXeNXEBcqv7s7wXwOy2dd7EUGwi+VPT +bfhBoXfqPS2lmF5Q02E/3a+qxO77w6PDUxddc/pqN8GLtwJbWK37nkh3TUphecEddjR s0cA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=aU3PsApVk31hTVf1jMdACWjudMTcKj7eONyAYkYoSk8=; b=rROhSb3tlVI6+7H0TZp9g6S0CHqx931HFWKuZolgNsZkdla9pxqfGbl4kezvRRMugb mTLxjt51uZP4x4zxR5qpxQmcCSEQNhwHBw88pXRx/4fl4k4MayhdMCDzwFzK2f3BNe50 V9zvFsL10wVw4S+qPZQjfFfefnyZkUy5f1NawW59C79EzmOK9aQtYbBGjcoBluXRjc9q BAQhDsRIWUtiTK8hMN/HovgIXby2b0J9bimmed+7cZolS2Yp0ovYi2ByWUz+LN1oEEPq ypf85IhxMwPp+/U1B/Z+GWZlp4cb0EfdwDhKvdx7Gv4+HqespahNvZsFogeouk+NujLM bfag== X-Gm-Message-State: APjAAAWDvqI3Rf4ISGdHey2At0VMIVBYl3/jDGNFCGkqpPiXdKYhnMsg WXoKgV/HnBaC75/EAfvdxKIfPg== X-Google-Smtp-Source: APXvYqzJC9kYokP8cn/Ouvoh39TBvtl0jXPW0iqTCbfDBn0VTYbUkesS9O43PAKWSzmIhr1EGq469g== X-Received: by 2002:a63:ef07:: with SMTP id u7mr1364007pgh.0.1554317435151; Wed, 03 Apr 2019 11:50:35 -0700 (PDT) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id e8sm40028740pfc.47.2019.04.03.11.50.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Apr 2019 11:50:35 -0700 (PDT) Date: Wed, 3 Apr 2019 11:50:32 -0700 From: Stephen Hemminger To: Mohammad Abdul Awal Cc: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com, stable@dpdk.org Message-ID: <20190403115032.492e1c57@shemminger-XPS-13-9360> 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-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: , X-List-Received-Date: Wed, 03 Apr 2019 18:50:36 -0000 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. 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 3ED9FA0679 for ; Wed, 3 Apr 2019 20:50:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 83DA71B563; Wed, 3 Apr 2019 20:50:37 +0200 (CEST) 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aU3PsApVk31hTVf1jMdACWjudMTcKj7eONyAYkYoSk8=; b=Yp+oSb8der08KAg+RlFrzvM37FhyrfSIFA9v0U/IbzKOQW35tjEUUY+txUa9FQ91Ig DMeaVj0Gt2o8dvOCcwCOjvB0GPepjTTZmsI3e+ccduKS7alXWBSdUT3akFh3v9hW65Ul 2ghPD/JIVFDtfOGlSRamaPPqkUEwzIcDkG9ghBMFrBcB4Mm26B+SlPoi+//U3QYlP7is rSB7ISBAC8+qpX/QRomqPguV+d6527u75AfRMcXeNXEBcqv7s7wXwOy2dd7EUGwi+VPT +bfhBoXfqPS2lmF5Q02E/3a+qxO77w6PDUxddc/pqN8GLtwJbWK37nkh3TUphecEddjR s0cA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=aU3PsApVk31hTVf1jMdACWjudMTcKj7eONyAYkYoSk8=; b=rROhSb3tlVI6+7H0TZp9g6S0CHqx931HFWKuZolgNsZkdla9pxqfGbl4kezvRRMugb mTLxjt51uZP4x4zxR5qpxQmcCSEQNhwHBw88pXRx/4fl4k4MayhdMCDzwFzK2f3BNe50 V9zvFsL10wVw4S+qPZQjfFfefnyZkUy5f1NawW59C79EzmOK9aQtYbBGjcoBluXRjc9q BAQhDsRIWUtiTK8hMN/HovgIXby2b0J9bimmed+7cZolS2Yp0ovYi2ByWUz+LN1oEEPq ypf85IhxMwPp+/U1B/Z+GWZlp4cb0EfdwDhKvdx7Gv4+HqespahNvZsFogeouk+NujLM bfag== X-Gm-Message-State: APjAAAWDvqI3Rf4ISGdHey2At0VMIVBYl3/jDGNFCGkqpPiXdKYhnMsg WXoKgV/HnBaC75/EAfvdxKIfPg== X-Google-Smtp-Source: APXvYqzJC9kYokP8cn/Ouvoh39TBvtl0jXPW0iqTCbfDBn0VTYbUkesS9O43PAKWSzmIhr1EGq469g== X-Received: by 2002:a63:ef07:: with SMTP id u7mr1364007pgh.0.1554317435151; Wed, 03 Apr 2019 11:50:35 -0700 (PDT) Received: from shemminger-XPS-13-9360 (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id e8sm40028740pfc.47.2019.04.03.11.50.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Apr 2019 11:50:35 -0700 (PDT) Date: Wed, 3 Apr 2019 11:50:32 -0700 From: Stephen Hemminger To: Mohammad Abdul Awal Cc: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@intel.com, arybchenko@solarflare.com, stable@dpdk.org Message-ID: <20190403115032.492e1c57@shemminger-XPS-13-9360> 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-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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: <20190403185032.8mnFB9gQET7PYO5ofViSrYIwq9hFXpNWaNacu-j7r08@z> 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.