DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/3] common/cnxk: check return value for error
@ 2022-02-12 12:38 Gowrishankar Muthukrishnan
  2022-02-12 12:38 ` [PATCH 2/3] common/cnx: fix unintended sign extension Gowrishankar Muthukrishnan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gowrishankar Muthukrishnan @ 2022-02-12 12:38 UTC (permalink / raw)
  To: dev
  Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao,
	jerinj, Gowrishankar Muthukrishnan

This patch fixes coverity issue by adding checks on return values.

Coverity issue: 373628, 374858, 370213, 370215
Fixes: af75aac78978 ("common/cnxk: support telemetry for NIX")
Fixes: d61138d4f0e ("drivers: remove direct access to interrupt handle")
Fixes: fcdef46b669 ("common/cnxk: support NIX TM debug and misc utils")
Fixes: df405df95ee ("common/cnxk: add NIX TM helper to alloc/free resource")

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 drivers/common/cnxk/cnxk_telemetry_nix.c | 3 +++
 drivers/common/cnxk/roc_irq.c            | 5 ++++-
 drivers/common/cnxk/roc_nix_debug.c      | 4 +++-
 drivers/common/cnxk/roc_nix_tm.c         | 6 ++++--
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/common/cnxk/cnxk_telemetry_nix.c b/drivers/common/cnxk/cnxk_telemetry_nix.c
index df6458039d..4119e9ee4f 100644
--- a/drivers/common/cnxk/cnxk_telemetry_nix.c
+++ b/drivers/common/cnxk/cnxk_telemetry_nix.c
@@ -765,6 +765,9 @@ cnxk_nix_tel_handle_info_x(const char *cmd, const char *params,
 
 	plt_strlcpy(buf, params, PCI_PRI_STR_SIZE + 1);
 	name = strtok(buf, ",");
+	if (name == NULL)
+		goto exit;
+
 	param = strtok(NULL, "\0");
 
 	node = nix_tel_node_get_by_pcidev_name(name);
diff --git a/drivers/common/cnxk/roc_irq.c b/drivers/common/cnxk/roc_irq.c
index 7a24297d72..010b121176 100644
--- a/drivers/common/cnxk/roc_irq.c
+++ b/drivers/common/cnxk/roc_irq.c
@@ -160,7 +160,10 @@ dev_irq_register(struct plt_intr_handle *intr_handle, plt_intr_callback_fn cb,
 		return rc;
 	}
 
-	plt_intr_efds_index_set(intr_handle, vec, fd);
+	rc = plt_intr_efds_index_set(intr_handle, vec, fd);
+	if (rc)
+		return rc;
+
 	nb_efd = (vec > (uint32_t)plt_intr_nb_efd_get(intr_handle)) ?
 		vec : (uint32_t)plt_intr_nb_efd_get(intr_handle);
 	plt_intr_nb_efd_set(intr_handle, nb_efd);
diff --git a/drivers/common/cnxk/roc_nix_debug.c b/drivers/common/cnxk/roc_nix_debug.c
index d5143882f5..1ae045172e 100644
--- a/drivers/common/cnxk/roc_nix_debug.c
+++ b/drivers/common/cnxk/roc_nix_debug.c
@@ -52,7 +52,9 @@ nix_bitmap_dump(struct plt_bitmap *bmp)
 	int i;
 
 	plt_bitmap_scan_init(bmp);
-	plt_bitmap_scan(bmp, &pos, &slab);
+	if (!plt_bitmap_scan(bmp, &pos, &slab))
+		return;
+
 	start_pos = pos;
 
 	nix_dump_no_nl("  \t\t[");
diff --git a/drivers/common/cnxk/roc_nix_tm.c b/drivers/common/cnxk/roc_nix_tm.c
index a0448bec61..517502b1af 100644
--- a/drivers/common/cnxk/roc_nix_tm.c
+++ b/drivers/common/cnxk/roc_nix_tm.c
@@ -1016,8 +1016,10 @@ nix_tm_assign_hw_id(struct nix *nix, struct nix_tm_node *parent,
 			return -EFAULT;
 		}
 
-		if (!slab)
-			plt_bitmap_scan(bmp, &pos, &slab);
+		if (!slab) {
+			if (!plt_bitmap_scan(bmp, &pos, &slab))
+				return -ENOENT;
+		}
 
 		if (child->priority == parent->rr_prio && spare_schq != -1) {
 			/* Use spare schq first if present */
-- 
2.25.1


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

end of thread, other threads:[~2022-02-18  4:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-12 12:38 [PATCH 1/3] common/cnxk: check return value for error Gowrishankar Muthukrishnan
2022-02-12 12:38 ` [PATCH 2/3] common/cnx: fix unintended sign extension Gowrishankar Muthukrishnan
2022-02-12 12:38 ` [PATCH 3/3] common/cnxk: fix uninitialized pointer read Gowrishankar Muthukrishnan
2022-02-18  4:20 ` [PATCH 1/3] common/cnxk: check return value for error Jerin Jacob

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).