vdpa/ifc: check return value for PCI config read
PATCH 1/1 vdpa/ifc: check return value for PCI config read
The return value of rte_pci_read_config should be checked.
Coverity issue: 302860
--- drivers/vdpa/ifc/base/ifcvf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/vdpa/ifc/base/ifcvf.c +6 -1
@@ -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 ;
Signature · 1 line
2.15.1
Quoted 38 lines
-----Original Message-----
From: Wang, Xiao W <[email protected]>
Sent: Tuesday, March 9, 2021 4:43 PM
To: Xia, Chenbo <[email protected]>
Cc: [email protected]; Wang, Xiao W <[email protected]>; [email protected]
Subject: [PATCH] vdpa/ifc: check return value for PCI config readThe return value of
rte_pci_read_configshould be checked.Coverity issue: 302860
Fixes a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")Signed-off-by Xiao Wang <[email protected]>--- drivers/vdpa/ifc/base/ifcvf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/vdpa/ifc/base/ifcvf.c +6
-2@@ -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 ; --
Quoted 1 line
2.15.1
Xia, Chenbo
AppliedQuoted 9 lines
-----Original Message-----
From: Wang, Xiao W <[email protected]>
Sent: Tuesday, March 9, 2021 4:43 PM
To: Xia, Chenbo <[email protected]>
Cc: [email protected]; Wang, Xiao W <[email protected]>; [email protected]
Subject: [PATCH] vdpa/ifc: check return value for PCI config readThe return value of
rte_pci_read_configshould be checked.
Quoted 7 lines
Coverity issue: 302860
Fixes a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")Signed-off-by Xiao Wang <[email protected]>--
2.15.1
Applied to next-virtio/main, Thanks!