patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] vdpa/ifc: check return value for PCI config read
@ 2021-03-09  8:43 Xiao Wang
  2021-03-25  2:41 ` Xia, Chenbo
  2021-03-31  6:51 ` Xia, Chenbo
  0 siblings, 2 replies; 3+ messages in thread
From: Xiao Wang @ 2021-03-09  8:43 UTC (permalink / raw)
  To: chenbo.xia; +Cc: dev, Xiao Wang, stable

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 <xiao.w.wang@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] vdpa/ifc: check return value for PCI config read
  2021-03-09  8:43 [dpdk-stable] [PATCH] vdpa/ifc: check return value for PCI config read Xiao Wang
@ 2021-03-25  2:41 ` Xia, Chenbo
  2021-03-31  6:51 ` Xia, Chenbo
  1 sibling, 0 replies; 3+ messages in thread
From: Xia, Chenbo @ 2021-03-25  2:41 UTC (permalink / raw)
  To: Wang, Xiao W; +Cc: dev, stable, Maxime Coquelin

> -----Original Message-----
> From: Wang, Xiao W <xiao.w.wang@intel.com>
> Sent: Tuesday, March 9, 2021 4:43 PM
> To: Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>; stable@dpdk.org
> Subject: [PATCH] vdpa/ifc: check return value for 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 <xiao.w.wang@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

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH] vdpa/ifc: check return value for PCI config read
  2021-03-09  8:43 [dpdk-stable] [PATCH] vdpa/ifc: check return value for PCI config read Xiao Wang
  2021-03-25  2:41 ` Xia, Chenbo
@ 2021-03-31  6:51 ` Xia, Chenbo
  1 sibling, 0 replies; 3+ messages in thread
From: Xia, Chenbo @ 2021-03-31  6:51 UTC (permalink / raw)
  To: Wang, Xiao W; +Cc: dev, stable, Maxime Coquelin

> -----Original Message-----
> From: Wang, Xiao W <xiao.w.wang@intel.com>
> Sent: Tuesday, March 9, 2021 4:43 PM
> To: Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>; stable@dpdk.org
> Subject: [PATCH] vdpa/ifc: check return value for 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 <xiao.w.wang@intel.com>
> --
> 2.15.1

Applied to next-virtio/main, Thanks!


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-31  6:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09  8:43 [dpdk-stable] [PATCH] vdpa/ifc: check return value for PCI config read Xiao Wang
2021-03-25  2:41 ` Xia, Chenbo
2021-03-31  6:51 ` Xia, Chenbo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).