DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] event/cnxk: fix out of bounds access
@ 2022-04-24 16:24 Gowrishankar Muthukrishnan
  2022-05-14 13:10 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: Gowrishankar Muthukrishnan @ 2022-04-24 16:24 UTC (permalink / raw)
  To: dev
  Cc: Jerin Jacob, Pavan Nikhilesh, Shijith Thotton,
	Gowrishankar Muthukrishnan

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


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

* Re: [PATCH] event/cnxk: fix out of bounds access
  2022-04-24 16:24 [PATCH] event/cnxk: fix out of bounds access Gowrishankar Muthukrishnan
@ 2022-05-14 13:10 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2022-05-14 13:10 UTC (permalink / raw)
  To: Gowrishankar Muthukrishnan
  Cc: dpdk-dev, Jerin Jacob, Pavan Nikhilesh, Shijith Thotton

On Sun, Apr 24, 2022 at 9:55 PM Gowrishankar Muthukrishnan
<gmuthukrishn@marvell.com> wrote:
>
> Fix out of bounds array access reporrted in coverity scan.

Fixed reported  typo

>
> Coverity issue: 375817
> Fixes: 2351506401e ("event/cnxk: add SSO selftest and dump")
>
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>

Acked-by: Jerin Jacob <jerinj@marvell.com>

Applied to dpdk-next-net-eventdev/for-main. Thanks

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

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

end of thread, other threads:[~2022-05-14 13:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24 16:24 [PATCH] event/cnxk: fix out of bounds access Gowrishankar Muthukrishnan
2022-05-14 13:10 ` 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).