From: Xiao Wang Date: Tue, 9 Mar 2021 08:43:15 +0000 (+0800) Subject: vdpa/ifc: check PCI config read X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=629d75653bc584a2927a87566bf00beea661f91b;p=dpdk.git vdpa/ifc: check PCI config read The return value of rte_pci_read_config should be checked. Coverity issue: 302860 Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver") Cc: stable@dpdk.org Signed-off-by: Xiao Wang Reviewed-by: Chenbo Xia --- 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;