Skip to content

Commit

Permalink
net/ifc: check VFIO query error
Browse files Browse the repository at this point in the history
[ upstream commit ac466a1 ]

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: a3f8150 ("net/ifcvf: add ifcvf vDPA driver")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
  • Loading branch information
XiaoWang1772 authored and kevintraynor committed Dec 11, 2019
1 parent e12bbb4 commit cf40f1b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/ifc/ifcvf_vdpa.c
Expand Up @@ -112,15 +112,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)
Expand Down

0 comments on commit cf40f1b

Please sign in to comment.