[PATCH 1/5] vdpa/nfp: fix checking return value
Chaoyong He
chaoyong.he at corigine.com
Wed Nov 15 04:23:06 CET 2023
CI found calling 'rte_vfio_get_group_num()' without checking return
value.
Coverity issue: 405356
Fixes: 7b2a1228c59d ("vdpa/nfp: add remap PCI memory")
Cc: stable at dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he at corigine.com>
Reviewed-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Peng Zhang <peng.zhang at corigine.com>
---
drivers/vdpa/nfp/nfp_vdpa.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/vdpa/nfp/nfp_vdpa.c b/drivers/vdpa/nfp/nfp_vdpa.c
index a1d1dc4f73..cef80b5476 100644
--- a/drivers/vdpa/nfp/nfp_vdpa.c
+++ b/drivers/vdpa/nfp/nfp_vdpa.c
@@ -113,8 +113,10 @@ nfp_vdpa_vfio_setup(struct nfp_vdpa_dev *device)
rte_pci_unmap_device(pci_dev);
rte_pci_device_name(&pci_dev->addr, dev_name, RTE_DEV_NAME_MAX_LEN);
- rte_vfio_get_group_num(rte_pci_get_sysfs_path(), dev_name,
+ ret = rte_vfio_get_group_num(rte_pci_get_sysfs_path(), dev_name,
&device->iommu_group);
+ if (ret <= 0)
+ return -1;
device->vfio_container_fd = rte_vfio_container_create();
if (device->vfio_container_fd < 0)
--
2.39.1
More information about the stable
mailing list