From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 68E06A04DD; Tue, 26 Nov 2019 07:12:43 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 85DCB28EE; Tue, 26 Nov 2019 07:12:42 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id C41FCA3; Tue, 26 Nov 2019 07:12:40 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Nov 2019 22:12:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,244,1571727600"; d="scan'208";a="239809373" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by fmsmga002.fm.intel.com with ESMTP; 25 Nov 2019 22:12:38 -0800 Date: Tue, 26 Nov 2019 14:08:49 +0800 From: Ye Xiaolong To: Xiao Wang Cc: dev@dpdk.org, john.mcnamara@intel.com, stable@dpdk.org Message-ID: <20191126060848.GH101220@intel.com> References: <20191126145931.61080-1-xiao.w.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191126145931.61080-1-xiao.w.wang@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH] net/ifc: fix unchecked return value 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" On 11/26, Xiao Wang wrote: >It's possible that we fail to get the IOMMU group of ifcvf device, this >patch adds a check on the return value. > >Coverity issue: 349894 >Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver") >Cc: stable@dpdk.org > >Signed-off-by: Xiao Wang >--- > drivers/net/ifc/ifcvf_vdpa.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c >index 9c562def0..da4667ba5 100644 >--- a/drivers/net/ifc/ifcvf_vdpa.c >+++ b/drivers/net/ifc/ifcvf_vdpa.c >@@ -136,15 +136,19 @@ ifcvf_vfio_setup(struct ifcvf_internal *internal) > struct rte_pci_device *dev = internal->pdev; > char devname[RTE_DEV_NAME_MAX_LEN] = {0}; > int iommu_group_num; >- int i; >+ int i, ret; > > internal->vfio_dev_fd = -1; > internal->vfio_group_fd = -1; > internal->vfio_container_fd = -1; > > rte_pci_device_name(&dev->addr, devname, RTE_DEV_NAME_MAX_LEN); >- rte_vfio_get_group_num(rte_pci_get_sysfs_path(), devname, >+ ret = rte_vfio_get_group_num(rte_pci_get_sysfs_path(), devname, > &iommu_group_num); >+ if (ret <= 0) { >+ DRV_LOG(ERR, "%s failed to get IOMMU group", devname); >+ return -1; >+ } > > internal->vfio_container_fd = rte_vfio_container_create(); > if (internal->vfio_container_fd < 0) >-- >2.15.1 > Reviewed-by: Xiaolong Ye