DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>,
	stable@dpdk.org, Long Wu <long.wu@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH 1/5] vdpa/nfp: fix checking return value
Date: Wed, 15 Nov 2023 11:23:06 +0800	[thread overview]
Message-ID: <20231115032310.756221-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20231115032310.756221-1-chaoyong.he@corigine.com>

CI found calling 'rte_vfio_get_group_num()' without checking return
value.

Coverity issue: 405356
Fixes: 7b2a1228c59d ("vdpa/nfp: add remap PCI memory")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/vdpa/nfp/nfp_vdpa.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/vdpa/nfp/nfp_vdpa.c b/drivers/vdpa/nfp/nfp_vdpa.c
index a1d1dc4f73..cef80b5476 100644
--- a/drivers/vdpa/nfp/nfp_vdpa.c
+++ b/drivers/vdpa/nfp/nfp_vdpa.c
@@ -113,8 +113,10 @@ nfp_vdpa_vfio_setup(struct nfp_vdpa_dev *device)
 	rte_pci_unmap_device(pci_dev);
 
 	rte_pci_device_name(&pci_dev->addr, dev_name, RTE_DEV_NAME_MAX_LEN);
-	rte_vfio_get_group_num(rte_pci_get_sysfs_path(), dev_name,
+	ret = rte_vfio_get_group_num(rte_pci_get_sysfs_path(), dev_name,
 			&device->iommu_group);
+	if (ret <= 0)
+		return -1;
 
 	device->vfio_container_fd = rte_vfio_container_create();
 	if (device->vfio_container_fd < 0)
-- 
2.39.1


  reply	other threads:[~2023-11-15  3:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15  3:23 [PATCH 0/5] fix coverity issues Chaoyong He
2023-11-15  3:23 ` Chaoyong He [this message]
2023-11-15  3:23 ` [PATCH 2/5] vdpa/nfp: fix integer handling issues Chaoyong He
2023-11-15  3:23 ` [PATCH 3/5] common/nfp: " Chaoyong He
2023-11-22 11:50   ` Thomas Monjalon
2023-11-23  1:23     ` Chaoyong He
2023-11-23  2:08       ` Thomas Monjalon
2023-11-15  3:23 ` [PATCH 4/5] net/nfp: fix integer shift problem Chaoyong He
2023-11-15  3:23 ` [PATCH 5/5] net/nfp: fix null pointer dereferences Chaoyong He

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=20231115032310.756221-2-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.com \
    --cc=stable@dpdk.org \
    /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).