[dpdk-dev] [PATCH] vdpa/ifc: check return value for PCI config read
Xiao Wang
xiao.w.wang at intel.com
Tue Mar 9 09:43:15 CET 2021
The return value of rte_pci_read_config should be checked.
Coverity issue: 302860
Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")
Cc: stable at dpdk.org
Signed-off-by: Xiao Wang <xiao.w.wang at intel.com>
---
drivers/vdpa/ifc/base/ifcvf.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c
index 3c0b2dff66..721cb1da8a 100644
--- a/drivers/vdpa/ifc/base/ifcvf.c
+++ b/drivers/vdpa/ifc/base/ifcvf.c
@@ -65,8 +65,13 @@ ifcvf_init_hw(struct ifcvf_hw *hw, PCI_DEV *dev)
hw->common_cfg = get_cap_addr(hw, &cap);
break;
case IFCVF_PCI_CAP_NOTIFY_CFG:
- PCI_READ_CONFIG_DWORD(dev, &hw->notify_off_multiplier,
+ ret = PCI_READ_CONFIG_DWORD(dev,
+ &hw->notify_off_multiplier,
pos + sizeof(cap));
+ if (ret < 0) {
+ DEBUGOUT("failed to read notify_off_multiplier\n");
+ return -1;
+ }
hw->notify_base = get_cap_addr(hw, &cap);
hw->notify_region = cap.bar;
break;
--
2.15.1
More information about the dev
mailing list