From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 20CCAA0547 for ; Fri, 26 Feb 2021 08:37:43 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 15E931CC586; Fri, 26 Feb 2021 08:37:43 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id E0CE240692; Fri, 26 Feb 2021 08:37:39 +0100 (CET) IronPort-SDR: t4HFxWbss4XgZp4L4VzrOiqPoVPoXdsYbPAQFE0TyE4m6Zlrv1DkWrWWPcL3178P6AjT9V8vgE i0xsw7fM+ZTA== X-IronPort-AV: E=McAfee;i="6000,8403,9906"; a="270780896" X-IronPort-AV: E=Sophos;i="5.81,207,1610438400"; d="scan'208";a="270780896" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2021 23:37:38 -0800 IronPort-SDR: TIMfVieVXw0N1K3wVDWbmhPbQwJ7JtnpCMadKowk4JPAHVi5DL/Bx8vvGGSXuAPn2RN5vrTNUT P3aUkQtggynw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,207,1610438400"; d="scan'208";a="442955032" Received: from wuwenjun.sh.intel.com ([10.67.110.153]) by orsmga001.jf.intel.com with ESMTP; 25 Feb 2021 23:37:32 -0800 From: Wenjun Wu To: dev@dpdk.org, qiming.yang@intel.com, qi.z.zhang@intel.com Cc: Wenjun Wu , stable@dpdk.org Date: Fri, 26 Feb 2021 15:22:00 +0800 Message-Id: <20210226072200.227939-1-wenjun1.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210226022542.214104-1> References: <20210226022542.214104-1> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v2] net/ice: fix unchecked return value X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Fix unchecked return values reported by coverity. Coverity issue: 349907 Fixes: 03a05924dad0 ("net/ice: support device-specific DDP package loading") Cc: stable@dpdk.org Signed-off-by: Wenjun Wu --- v2: modify err message; fix the issue related to that reported by coverity --- drivers/net/ice/ice_ethdev.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index dfd99ace9..f43b2e0b2 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -1663,8 +1663,14 @@ ice_pkg_file_search_path(struct rte_pci_device *pci_dev, char *pkg_file) pos = rte_pci_find_ext_capability(pci_dev, RTE_PCI_EXT_CAP_ID_DSN); if (pos) { - rte_pci_read_config(pci_dev, &dsn_low, 4, pos + 4); - rte_pci_read_config(pci_dev, &dsn_high, 4, pos + 8); + if (rte_pci_read_config(pci_dev, &dsn_low, 4, pos + 4) < 0) { + PMD_INIT_LOG(ERR, "Failed to read pci config space\n"); + return -1; + } + if (rte_pci_read_config(pci_dev, &dsn_high, 4, pos + 8) < 0) { + PMD_INIT_LOG(ERR, "Failed to read pci config space\n"); + return -1; + } snprintf(opt_ddp_filename, ICE_MAX_PKG_FILENAME_SIZE, "ice-%08x%08x.pkg", dsn_high, dsn_low); } else { @@ -1727,7 +1733,11 @@ static int ice_load_pkg(struct rte_eth_dev *dev) struct ice_adapter *ad = ICE_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); - ice_pkg_file_search_path(pci_dev, pkg_file); + err = ice_pkg_file_search_path(pci_dev, pkg_file); + if (err) { + PMD_INIT_LOG(ERR, "failed to search file path\n"); + return err; + } file = fopen(pkg_file, "rb"); if (!file) { -- 2.25.1