All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] event/cnxk: fix incompatible casting of variables
@ 2022-02-12 12:39 Gowrishankar Muthukrishnan
  2022-02-12 12:39 ` [PATCH 2/3] event/cnxk: fix memory leak Gowrishankar Muthukrishnan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gowrishankar Muthukrishnan @ 2022-02-12 12:39 UTC (permalink / raw)
  To: dev; +Cc: Pavan Nikhilesh, Shijith Thotton, jerinj, Gowrishankar Muthukrishnan

Fix incompatible casting on variables reported by coverity scan.

Fixes: 6223ede2036 ("event/cnxk: add event port link and unlink")
Coverity issue: 370582 370584

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 drivers/event/cnxk/cn10k_eventdev.c |  4 ++--
 drivers/event/cnxk/cn9k_eventdev.c  | 11 ++++-------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c
index 7b7ce44c74..2bcf5066c4 100644
--- a/drivers/event/cnxk/cn10k_eventdev.c
+++ b/drivers/event/cnxk/cn10k_eventdev.c
@@ -98,10 +98,10 @@ cn10k_sso_hws_release(void *arg, void *hws)
 {
 	struct cnxk_sso_evdev *dev = arg;
 	struct cn10k_sso_hws *ws = hws;
-	int i;
+	uint16_t i;
 
 	for (i = 0; i < dev->nb_event_queues; i++)
-		roc_sso_hws_unlink(&dev->sso, ws->hws_id, (uint16_t *)&i, 1);
+		roc_sso_hws_unlink(&dev->sso, ws->hws_id, &i, 1);
 	memset(ws, 0, sizeof(*ws));
 }
 
diff --git a/drivers/event/cnxk/cn9k_eventdev.c b/drivers/event/cnxk/cn9k_eventdev.c
index 4611936b7f..3413467edc 100644
--- a/drivers/event/cnxk/cn9k_eventdev.c
+++ b/drivers/event/cnxk/cn9k_eventdev.c
@@ -97,24 +97,21 @@ cn9k_sso_hws_release(void *arg, void *hws)
 	struct cnxk_sso_evdev *dev = arg;
 	struct cn9k_sso_hws_dual *dws;
 	struct cn9k_sso_hws *ws;
-	int i;
+	uint16_t i;
 
 	if (dev->dual_ws) {
 		dws = hws;
 		for (i = 0; i < dev->nb_event_queues; i++) {
 			roc_sso_hws_unlink(&dev->sso,
-					   CN9K_DUAL_WS_PAIR_ID(dws->hws_id, 0),
-					   (uint16_t *)&i, 1);
+					   CN9K_DUAL_WS_PAIR_ID(dws->hws_id, 0), &i, 1);
 			roc_sso_hws_unlink(&dev->sso,
-					   CN9K_DUAL_WS_PAIR_ID(dws->hws_id, 1),
-					   (uint16_t *)&i, 1);
+					   CN9K_DUAL_WS_PAIR_ID(dws->hws_id, 1), &i, 1);
 		}
 		memset(dws, 0, sizeof(*dws));
 	} else {
 		ws = hws;
 		for (i = 0; i < dev->nb_event_queues; i++)
-			roc_sso_hws_unlink(&dev->sso, ws->hws_id,
-					   (uint16_t *)&i, 1);
+			roc_sso_hws_unlink(&dev->sso, ws->hws_id, &i, 1);
 		memset(ws, 0, sizeof(*ws));
 	}
 }
-- 
2.25.1


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

* [PATCH 2/3] event/cnxk: fix memory leak
  2022-02-12 12:39 [PATCH 1/3] event/cnxk: fix incompatible casting of variables Gowrishankar Muthukrishnan
@ 2022-02-12 12:39 ` Gowrishankar Muthukrishnan
  2022-02-12 12:39 ` [PATCH 3/3] event/cnxk: fix uninitialized local variable Gowrishankar Muthukrishnan
  2022-02-22  9:50 ` [PATCH 1/3] event/cnxk: fix incompatible casting of variables Jerin Jacob
  2 siblings, 0 replies; 4+ messages in thread
From: Gowrishankar Muthukrishnan @ 2022-02-12 12:39 UTC (permalink / raw)
  To: dev; +Cc: Pavan Nikhilesh, Shijith Thotton, jerinj, Gowrishankar Muthukrishnan

Fix memory leaks reported in coverity scan.

Fixes: 8a3d58c189f ("event/cnxk: add option to control timer adapters")
Coverity issue: 374990 374991

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

diff --git a/drivers/event/cnxk/cnxk_tim_evdev.c b/drivers/event/cnxk/cnxk_tim_evdev.c
index 4d22ac6ac3..af67235503 100644
--- a/drivers/event/cnxk/cnxk_tim_evdev.c
+++ b/drivers/event/cnxk/cnxk_tim_evdev.c
@@ -560,7 +560,7 @@ cnxk_tim_parse_ring_ctl_list(const char *value, void *opaque)
 	char *f = s;
 
 	if (s == NULL || !strlen(s))
-		return;
+		goto free;
 
 	while (*s) {
 		if (*s == '[')
@@ -579,6 +579,7 @@ cnxk_tim_parse_ring_ctl_list(const char *value, void *opaque)
 		s++;
 	}
 
+free:
 	free(f);
 }
 
@@ -607,7 +608,7 @@ cnxk_tim_parse_clk_list(const char *value, void *opaque)
 	int i = 0;
 
 	if (str == NULL || !strlen(str))
-		return;
+		goto free;
 
 	tok = strtok(str, "-");
 	while (tok != NULL && src[i] != ROC_TIM_CLK_SRC_INVALID) {
@@ -616,6 +617,7 @@ cnxk_tim_parse_clk_list(const char *value, void *opaque)
 		i++;
 	}
 
+free:
 	free(str);
 }
 
-- 
2.25.1


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

* [PATCH 3/3] event/cnxk: fix uninitialized local variable
  2022-02-12 12:39 [PATCH 1/3] event/cnxk: fix incompatible casting of variables Gowrishankar Muthukrishnan
  2022-02-12 12:39 ` [PATCH 2/3] event/cnxk: fix memory leak Gowrishankar Muthukrishnan
@ 2022-02-12 12:39 ` Gowrishankar Muthukrishnan
  2022-02-22  9:50 ` [PATCH 1/3] event/cnxk: fix incompatible casting of variables Jerin Jacob
  2 siblings, 0 replies; 4+ messages in thread
From: Gowrishankar Muthukrishnan @ 2022-02-12 12:39 UTC (permalink / raw)
  To: dev; +Cc: Pavan Nikhilesh, Shijith Thotton, jerinj, Gowrishankar Muthukrishnan

Fix uninitialized local variable as reported in coverity scan.

Fixes: 300b796262a ("event/cnxk: add timer arm routine")
Fixes: 300b796262a ("event/cnxk: add timer arm routine"
Coverity issue: 370578, 370579, 370587

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
 drivers/event/cnxk/cnxk_tim_worker.c | 2 +-
 drivers/event/cnxk/cnxk_tim_worker.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/event/cnxk/cnxk_tim_worker.c b/drivers/event/cnxk/cnxk_tim_worker.c
index 3ce99864a6..dfcfbdc797 100644
--- a/drivers/event/cnxk/cnxk_tim_worker.c
+++ b/drivers/event/cnxk/cnxk_tim_worker.c
@@ -63,7 +63,7 @@ cnxk_tim_timer_arm_burst(const struct rte_event_timer_adapter *adptr,
 	struct cnxk_tim_ring *tim_ring = adptr->data->adapter_priv;
 	struct cnxk_tim_ent entry;
 	uint16_t index;
-	int ret;
+	int ret = 0;
 
 	cnxk_tim_sync_start_cyc(tim_ring);
 	for (index = 0; index < nb_timers; index++) {
diff --git a/drivers/event/cnxk/cnxk_tim_worker.h b/drivers/event/cnxk/cnxk_tim_worker.h
index 78e36ffafe..0c9f29cfbe 100644
--- a/drivers/event/cnxk/cnxk_tim_worker.h
+++ b/drivers/event/cnxk/cnxk_tim_worker.h
@@ -233,8 +233,8 @@ cnxk_tim_add_entry_sp(struct cnxk_tim_ring *const tim_ring,
 		      const struct cnxk_tim_ent *const pent,
 		      const uint8_t flags)
 {
+	struct cnxk_tim_ent *chunk = NULL;
 	struct cnxk_tim_bkt *mirr_bkt;
-	struct cnxk_tim_ent *chunk;
 	struct cnxk_tim_bkt *bkt;
 	uint64_t lock_sema;
 	int16_t rem;
@@ -316,8 +316,8 @@ cnxk_tim_add_entry_mp(struct cnxk_tim_ring *const tim_ring,
 		      const struct cnxk_tim_ent *const pent,
 		      const uint8_t flags)
 {
+	struct cnxk_tim_ent *chunk = NULL;
 	struct cnxk_tim_bkt *mirr_bkt;
-	struct cnxk_tim_ent *chunk;
 	struct cnxk_tim_bkt *bkt;
 	uint64_t lock_sema;
 	int64_t rem;
-- 
2.25.1


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

* Re: [PATCH 1/3] event/cnxk: fix incompatible casting of variables
  2022-02-12 12:39 [PATCH 1/3] event/cnxk: fix incompatible casting of variables Gowrishankar Muthukrishnan
  2022-02-12 12:39 ` [PATCH 2/3] event/cnxk: fix memory leak Gowrishankar Muthukrishnan
  2022-02-12 12:39 ` [PATCH 3/3] event/cnxk: fix uninitialized local variable Gowrishankar Muthukrishnan
@ 2022-02-22  9:50 ` Jerin Jacob
  2 siblings, 0 replies; 4+ messages in thread
From: Jerin Jacob @ 2022-02-22  9:50 UTC (permalink / raw)
  To: Gowrishankar Muthukrishnan
  Cc: dpdk-dev, Pavan Nikhilesh, Shijith Thotton, Jerin Jacob

On Sat, Feb 12, 2022 at 6:10 PM Gowrishankar Muthukrishnan
<gmuthukrishn@marvell.com> wrote:
>
> Fix incompatible casting on variables reported by coverity scan.

Series applied to dpdk-next-net-eventdev/for-main. Thanks



>
> Fixes: 6223ede2036 ("event/cnxk: add event port link and unlink")
> Coverity issue: 370582 370584
>
> Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
> ---
>  drivers/event/cnxk/cn10k_eventdev.c |  4 ++--
>  drivers/event/cnxk/cn9k_eventdev.c  | 11 ++++-------
>  2 files changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c
> index 7b7ce44c74..2bcf5066c4 100644
> --- a/drivers/event/cnxk/cn10k_eventdev.c
> +++ b/drivers/event/cnxk/cn10k_eventdev.c
> @@ -98,10 +98,10 @@ cn10k_sso_hws_release(void *arg, void *hws)
>  {
>         struct cnxk_sso_evdev *dev = arg;
>         struct cn10k_sso_hws *ws = hws;
> -       int i;
> +       uint16_t i;
>
>         for (i = 0; i < dev->nb_event_queues; i++)
> -               roc_sso_hws_unlink(&dev->sso, ws->hws_id, (uint16_t *)&i, 1);
> +               roc_sso_hws_unlink(&dev->sso, ws->hws_id, &i, 1);
>         memset(ws, 0, sizeof(*ws));
>  }
>
> diff --git a/drivers/event/cnxk/cn9k_eventdev.c b/drivers/event/cnxk/cn9k_eventdev.c
> index 4611936b7f..3413467edc 100644
> --- a/drivers/event/cnxk/cn9k_eventdev.c
> +++ b/drivers/event/cnxk/cn9k_eventdev.c
> @@ -97,24 +97,21 @@ cn9k_sso_hws_release(void *arg, void *hws)
>         struct cnxk_sso_evdev *dev = arg;
>         struct cn9k_sso_hws_dual *dws;
>         struct cn9k_sso_hws *ws;
> -       int i;
> +       uint16_t i;
>
>         if (dev->dual_ws) {
>                 dws = hws;
>                 for (i = 0; i < dev->nb_event_queues; i++) {
>                         roc_sso_hws_unlink(&dev->sso,
> -                                          CN9K_DUAL_WS_PAIR_ID(dws->hws_id, 0),
> -                                          (uint16_t *)&i, 1);
> +                                          CN9K_DUAL_WS_PAIR_ID(dws->hws_id, 0), &i, 1);
>                         roc_sso_hws_unlink(&dev->sso,
> -                                          CN9K_DUAL_WS_PAIR_ID(dws->hws_id, 1),
> -                                          (uint16_t *)&i, 1);
> +                                          CN9K_DUAL_WS_PAIR_ID(dws->hws_id, 1), &i, 1);
>                 }
>                 memset(dws, 0, sizeof(*dws));
>         } else {
>                 ws = hws;
>                 for (i = 0; i < dev->nb_event_queues; i++)
> -                       roc_sso_hws_unlink(&dev->sso, ws->hws_id,
> -                                          (uint16_t *)&i, 1);
> +                       roc_sso_hws_unlink(&dev->sso, ws->hws_id, &i, 1);
>                 memset(ws, 0, sizeof(*ws));
>         }
>  }
> --
> 2.25.1
>

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

end of thread, other threads:[~2022-02-22  9:51 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:39 [PATCH 1/3] event/cnxk: fix incompatible casting of variables Gowrishankar Muthukrishnan
2022-02-12 12:39 ` [PATCH 2/3] event/cnxk: fix memory leak Gowrishankar Muthukrishnan
2022-02-12 12:39 ` [PATCH 3/3] event/cnxk: fix uninitialized local variable Gowrishankar Muthukrishnan
2022-02-22  9:50 ` [PATCH 1/3] event/cnxk: fix incompatible casting of variables Jerin Jacob

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.