From: Xiao Wang <xiao.w.wang@intel.com>
To: xiaolong.ye@intel.com
Cc: dev@dpdk.org, john.mcnamara@intel.com,
Xiao Wang <xiao.w.wang@intel.com>,
stable@dpdk.org
Subject: [dpdk-dev] [PATCH] net/ifc: fix unchecked return value
Date: Tue, 26 Nov 2019 09:59:31 -0500 [thread overview]
Message-ID: <20191126145931.61080-1-xiao.w.wang@intel.com> (raw)
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
next reply other threads:[~2019-11-26 3:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 14:59 Xiao Wang [this message]
2019-11-26 6:08 ` Ye Xiaolong
2019-11-26 12:15 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191126145931.61080-1-xiao.w.wang@intel.com \
--to=xiao.w.wang@intel.com \
--cc=dev@dpdk.org \
--cc=john.mcnamara@intel.com \
--cc=stable@dpdk.org \
--cc=xiaolong.ye@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).