From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 36C871E2F for ; Wed, 2 May 2018 18:08:26 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 May 2018 09:08:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,354,1520924400"; d="scan'208";a="42482814" Received: from dwdohert-ws.ir.intel.com ([163.33.210.60]) by fmsmga002.fm.intel.com with ESMTP; 02 May 2018 09:08:23 -0700 From: Declan Doherty To: dev@dpdk.org Cc: Declan Doherty Date: Wed, 2 May 2018 16:59:41 +0100 Message-Id: <20180502155941.1338-3-declan.doherty@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180502155941.1338-1-declan.doherty@intel.com> References: <20180430153258.1101-1-declan.doherty@intel.com> <20180502155941.1338-1-declan.doherty@intel.com> Subject: [dpdk-dev] [dpdk-dev 3/3][PATCH v2] net/ixgbe: add null pointer check for pf_ethdev 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, 02 May 2018 16:08:27 -0000 Add NULL parameter check for rte_eth_dev_allocated() API call to eth_ixgbe_pci_probe(). Coverity Issue: 277216 Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports") Signed-off-by: Declan Doherty --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index a05527a91..91179e9b2 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1745,9 +1745,11 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, if (retval || eth_da.nb_representor_ports < 1) return retval; - /* probe VF representor ports */ pf_ethdev = rte_eth_dev_allocated(pci_dev->device.name); + if (pf_ethdev == NULL) + return -ENODEV; + /* probe VF representor ports */ for (i = 0; i < eth_da.nb_representor_ports; i++) { struct ixgbe_vf_info *vfinfo; struct ixgbe_vf_representor representor; -- 2.14.3