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 715D3A05D3 for ; Tue, 23 Apr 2019 17:31:07 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 58D2B1B3A3; Tue, 23 Apr 2019 17:31:06 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 08A9F1B395; Tue, 23 Apr 2019 17:31:04 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Apr 2019 08:31:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,386,1549958400"; d="scan'208";a="138121976" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by orsmga006.jf.intel.com with ESMTP; 23 Apr 2019 08:31:02 -0700 From: Ferruh Yigit To: Bruce Richardson Cc: dev@dpdk.org, stable@dpdk.org Date: Tue, 23 Apr 2019 16:31:00 +0100 Message-Id: <20190423153100.97996-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190423153100.iahp9AgroUnlfUqzb9ImQgRnsQxSLayeA2Hz4qFb9Ts@z> '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; } -- 2.20.1