DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>
Cc: Jerin Jacob <jerinj@marvell.com>,
	Pavan Nikhilesh <pbhagavatula@marvell.com>,
	Shijith Thotton <sthotton@marvell.com>,
	Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Subject: [PATCH] event/cnxk: fix out of bounds access
Date: Sun, 24 Apr 2022 21:54:55 +0530	[thread overview]
Message-ID: <20220424162455.1681020-1-gmuthukrishn@marvell.com> (raw)

Fix out of bounds array access reporrted in coverity scan.

Coverity issue: 375817
Fixes: 2351506401e ("event/cnxk: add SSO selftest and dump")

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 drivers/event/cnxk/cnxk_eventdev_selftest.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/event/cnxk/cnxk_eventdev_selftest.c b/drivers/event/cnxk/cnxk_eventdev_selftest.c
index 2fe6467f88..3aa6f081a7 100644
--- a/drivers/event/cnxk/cnxk_eventdev_selftest.c
+++ b/drivers/event/cnxk/cnxk_eventdev_selftest.c
@@ -626,6 +626,12 @@ launch_workers_and_wait(int (*main_thread)(void *),
 		/* start core */ -1,
 		/* skip main */ 1,
 		/* wrap */ 0);
+	if (w_lcore == RTE_MAX_LCORE) {
+		plt_err("Failed to get next available lcore");
+		free(param);
+		return -1;
+	}
+
 	rte_eal_remote_launch(main_thread, &param[0], w_lcore);
 
 	for (port = 1; port < nb_workers; port++) {
@@ -635,6 +641,12 @@ launch_workers_and_wait(int (*main_thread)(void *),
 		param[port].dequeue_tmo_ticks = dequeue_tmo_ticks;
 		rte_atomic_thread_fence(__ATOMIC_RELEASE);
 		w_lcore = rte_get_next_lcore(w_lcore, 1, 0);
+		if (w_lcore == RTE_MAX_LCORE) {
+			plt_err("Failed to get next available lcore");
+			free(param);
+			return -1;
+		}
+
 		rte_eal_remote_launch(worker_thread, &param[port], w_lcore);
 	}
 
-- 
2.25.1


             reply	other threads:[~2022-04-24 16:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24 16:24 Gowrishankar Muthukrishnan [this message]
2022-05-14 13:10 ` Jerin Jacob

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=20220424162455.1681020-1-gmuthukrishn@marvell.com \
    --to=gmuthukrishn@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=pbhagavatula@marvell.com \
    --cc=sthotton@marvell.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).