* Re: [dpdk-stable] [PATCH] net/ifc: fix unchecked return value
2019-11-26 14:59 [dpdk-stable] [PATCH] net/ifc: fix unchecked return value Xiao Wang
@ 2019-11-26 6:08 ` Ye Xiaolong
2019-11-26 12:15 ` Ferruh Yigit
0 siblings, 1 reply; 3+ messages in thread
From: Ye Xiaolong @ 2019-11-26 6:08 UTC (permalink / raw)
To: Xiao Wang; +Cc: dev, john.mcnamara, stable
On 11/26, Xiao Wang wrote:
>It's possible that we fail to get the IOMMU group of ifcvf device, this
>patch adds a check on the return value.
>
>Coverity issue: 349894
>Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")
>Cc: stable@dpdk.org
>
>Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
>---
> drivers/net/ifc/ifcvf_vdpa.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
>index 9c562def0..da4667ba5 100644
>--- a/drivers/net/ifc/ifcvf_vdpa.c
>+++ b/drivers/net/ifc/ifcvf_vdpa.c
>@@ -136,15 +136,19 @@ ifcvf_vfio_setup(struct ifcvf_internal *internal)
> struct rte_pci_device *dev = internal->pdev;
> char devname[RTE_DEV_NAME_MAX_LEN] = {0};
> int iommu_group_num;
>- int i;
>+ int i, ret;
>
> internal->vfio_dev_fd = -1;
> internal->vfio_group_fd = -1;
> internal->vfio_container_fd = -1;
>
> rte_pci_device_name(&dev->addr, devname, RTE_DEV_NAME_MAX_LEN);
>- rte_vfio_get_group_num(rte_pci_get_sysfs_path(), devname,
>+ ret = rte_vfio_get_group_num(rte_pci_get_sysfs_path(), devname,
> &iommu_group_num);
>+ if (ret <= 0) {
>+ DRV_LOG(ERR, "%s failed to get IOMMU group", devname);
>+ return -1;
>+ }
>
> internal->vfio_container_fd = rte_vfio_container_create();
> if (internal->vfio_container_fd < 0)
>--
>2.15.1
>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-stable] [PATCH] net/ifc: fix unchecked return value
2019-11-26 6:08 ` Ye Xiaolong
@ 2019-11-26 12:15 ` Ferruh Yigit
0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2019-11-26 12:15 UTC (permalink / raw)
To: Ye Xiaolong, Xiao Wang; +Cc: dev, john.mcnamara, stable
On 11/26/2019 6:08 AM, Ye Xiaolong wrote:
> On 11/26, Xiao Wang wrote:
>> It's possible that we fail to get the IOMMU group of ifcvf device, this
>> patch adds a check on the return value.
>>
>> Coverity issue: 349894
>> Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
>> ---
>> drivers/net/ifc/ifcvf_vdpa.c | 8 ++++++--
>> 1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
>> index 9c562def0..da4667ba5 100644
>> --- a/drivers/net/ifc/ifcvf_vdpa.c
>> +++ b/drivers/net/ifc/ifcvf_vdpa.c
>> @@ -136,15 +136,19 @@ ifcvf_vfio_setup(struct ifcvf_internal *internal)
>> struct rte_pci_device *dev = internal->pdev;
>> char devname[RTE_DEV_NAME_MAX_LEN] = {0};
>> int iommu_group_num;
>> - int i;
>> + int i, ret;
>>
>> internal->vfio_dev_fd = -1;
>> internal->vfio_group_fd = -1;
>> internal->vfio_container_fd = -1;
>>
>> rte_pci_device_name(&dev->addr, devname, RTE_DEV_NAME_MAX_LEN);
>> - rte_vfio_get_group_num(rte_pci_get_sysfs_path(), devname,
>> + ret = rte_vfio_get_group_num(rte_pci_get_sysfs_path(), devname,
>> &iommu_group_num);
>> + if (ret <= 0) {
>> + DRV_LOG(ERR, "%s failed to get IOMMU group", devname);
>> + return -1;
>> + }
>>
>> internal->vfio_container_fd = rte_vfio_container_create();
>> if (internal->vfio_container_fd < 0)
>> --
>> 2.15.1
>>
>
> Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-stable] [PATCH] net/ifc: fix unchecked return value
@ 2019-11-26 14:59 Xiao Wang
2019-11-26 6:08 ` Ye Xiaolong
0 siblings, 1 reply; 3+ messages in thread
From: Xiao Wang @ 2019-11-26 14:59 UTC (permalink / raw)
To: xiaolong.ye; +Cc: dev, john.mcnamara, Xiao Wang, stable
It's possible that we fail to get the IOMMU group of ifcvf device, this
patch adds a check on the return value.
Coverity issue: 349894
Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")
Cc: stable@dpdk.org
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
drivers/net/ifc/ifcvf_vdpa.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
index 9c562def0..da4667ba5 100644
--- a/drivers/net/ifc/ifcvf_vdpa.c
+++ b/drivers/net/ifc/ifcvf_vdpa.c
@@ -136,15 +136,19 @@ ifcvf_vfio_setup(struct ifcvf_internal *internal)
struct rte_pci_device *dev = internal->pdev;
char devname[RTE_DEV_NAME_MAX_LEN] = {0};
int iommu_group_num;
- int i;
+ int i, ret;
internal->vfio_dev_fd = -1;
internal->vfio_group_fd = -1;
internal->vfio_container_fd = -1;
rte_pci_device_name(&dev->addr, devname, RTE_DEV_NAME_MAX_LEN);
- rte_vfio_get_group_num(rte_pci_get_sysfs_path(), devname,
+ ret = rte_vfio_get_group_num(rte_pci_get_sysfs_path(), devname,
&iommu_group_num);
+ if (ret <= 0) {
+ DRV_LOG(ERR, "%s failed to get IOMMU group", devname);
+ return -1;
+ }
internal->vfio_container_fd = rte_vfio_container_create();
if (internal->vfio_container_fd < 0)
--
2.15.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-11-26 12:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-26 14:59 [dpdk-stable] [PATCH] net/ifc: fix unchecked return value Xiao Wang
2019-11-26 6:08 ` Ye Xiaolong
2019-11-26 12:15 ` Ferruh Yigit
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).