From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 23D2F1B43F; Tue, 23 Apr 2019 17:50:03 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 08:50:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="340038327" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.48]) by fmsmga005.fm.intel.com with SMTP; 23 Apr 2019 08:50:01 -0700 Received: by (sSMTP sendmail emulation); Tue, 23 Apr 2019 16:50:00 +0100 Date: Tue, 23 Apr 2019 16:49:59 +0100 From: Bruce Richardson To: Ferruh Yigit Cc: dev@dpdk.org, stable@dpdk.org Message-ID: <20190423154959.GA1864@bricha3-MOBL.ger.corp.intel.com> References: <20190423153100.97996-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190423153100.97996-1-ferruh.yigit@intel.com> User-Agent: Mutt/1.11.4 (2019-03-13) Subject: Re: [dpdk-dev] [PATCH] net/ring: fix return value check 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: Tue, 23 Apr 2019 15:50:04 -0000 On Tue, Apr 23, 2019 at 04:31:00PM +0100, Ferruh Yigit wrote: > 'rte_eth_dev_get_port_by_name()' return value is not checked caught by > coverity, adding return value check. > > Coverity issue: 305853 > Fixes: 96cb19521147 ("net/ring: use EAL APIs in PMD specific API") > Cc: stable@dpdk.org > > Signed-off-by: Ferruh Yigit > --- > drivers/net/ring/rte_eth_ring.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c > index 115a882b5..5ec646594 100644 > --- a/drivers/net/ring/rte_eth_ring.c > +++ b/drivers/net/ring/rte_eth_ring.c > @@ -385,7 +385,11 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], > return -1; > } > > - rte_eth_dev_get_port_by_name(ring_name, &port_id); > + ret = rte_eth_dev_get_port_by_name(ring_name, &port_id); > + if (ret) { > + rte_errno = ENODEV; > + return -1; > + } > > return port_id; > } Looks reasonable to me. Acked-by: Bruce Richardson 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 34A64A05D3 for ; Tue, 23 Apr 2019 17:50:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 101E61B442; Tue, 23 Apr 2019 17:50:06 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 23D2F1B43F; Tue, 23 Apr 2019 17:50:03 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 08:50:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="340038327" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.48]) by fmsmga005.fm.intel.com with SMTP; 23 Apr 2019 08:50:01 -0700 Received: by (sSMTP sendmail emulation); Tue, 23 Apr 2019 16:50:00 +0100 Date: Tue, 23 Apr 2019 16:49:59 +0100 From: Bruce Richardson To: Ferruh Yigit Cc: dev@dpdk.org, stable@dpdk.org Message-ID: <20190423154959.GA1864@bricha3-MOBL.ger.corp.intel.com> References: <20190423153100.97996-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline In-Reply-To: <20190423153100.97996-1-ferruh.yigit@intel.com> User-Agent: Mutt/1.11.4 (2019-03-13) Subject: Re: [dpdk-dev] [PATCH] net/ring: fix return value check 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: <20190423154959.yGGMHyTJEL7aLqZ6oS5PsCMz13d-YPIvnZnGkipnzEw@z> On Tue, Apr 23, 2019 at 04:31:00PM +0100, Ferruh Yigit wrote: > 'rte_eth_dev_get_port_by_name()' return value is not checked caught by > coverity, adding return value check. > > Coverity issue: 305853 > Fixes: 96cb19521147 ("net/ring: use EAL APIs in PMD specific API") > Cc: stable@dpdk.org > > Signed-off-by: Ferruh Yigit > --- > drivers/net/ring/rte_eth_ring.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c > index 115a882b5..5ec646594 100644 > --- a/drivers/net/ring/rte_eth_ring.c > +++ b/drivers/net/ring/rte_eth_ring.c > @@ -385,7 +385,11 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[], > return -1; > } > > - rte_eth_dev_get_port_by_name(ring_name, &port_id); > + ret = rte_eth_dev_get_port_by_name(ring_name, &port_id); > + if (ret) { > + rte_errno = ENODEV; > + return -1; > + } > > return port_id; > } Looks reasonable to me. Acked-by: Bruce Richardson