patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v1] common/cnxk: fix integer overflow
@ 2024-07-18  6:34 Ankur Dwivedi
  2024-07-22 17:39 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: Ankur Dwivedi @ 2024-07-18  6:34 UTC (permalink / raw)
  To: dev; +Cc: kirankumark, hkalra, jerinj, Ankur Dwivedi, stable

The expression flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US is
evaluated using 32 bit arithmetic. An integer overflow may occur when
the value is too large to fit in 32 bits. This patch resolves this by
casting flow_age->aging_poll_freq to 64 bit.

Coverity issue: 428156
Fixes: a4878294318e ("common/cnxk: fix flow aging on application exit")
Cc: stable@dpdk.org

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
---
 drivers/common/cnxk/roc_npc_aging.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c
index 1e85033e2a..258c15e341 100644
--- a/drivers/common/cnxk/roc_npc_aging.c
+++ b/drivers/common/cnxk/roc_npc_aging.c
@@ -145,7 +145,7 @@ npc_age_wait_until(struct roc_npc_flow_age *flow_age)
 		plt_delay_us(sleep);
 		timeout += sleep;
 	} while (!flow_age->aged_flows_get_thread_exit &&
-		 (timeout < (flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US)));
+		 (timeout < ((uint64_t)flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US)));
 }
 
 uint32_t
-- 
2.25.1


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

* Re: [PATCH v1] common/cnxk: fix integer overflow
  2024-07-18  6:34 [PATCH v1] common/cnxk: fix integer overflow Ankur Dwivedi
@ 2024-07-22 17:39 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2024-07-22 17:39 UTC (permalink / raw)
  To: Ankur Dwivedi; +Cc: dev, kirankumark, hkalra, jerinj, stable

On Thu, Jul 18, 2024 at 12:13 PM Ankur Dwivedi <adwivedi@marvell.com> wrote:
>
> The expression flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US is
> evaluated using 32 bit arithmetic. An integer overflow may occur when
> the value is too large to fit in 32 bits. This patch resolves this by
> casting flow_age->aging_poll_freq to 64 bit.
>
> Coverity issue: 428156
> Fixes: a4878294318e ("common/cnxk: fix flow aging on application exit")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>

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


> ---
>  drivers/common/cnxk/roc_npc_aging.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c
> index 1e85033e2a..258c15e341 100644
> --- a/drivers/common/cnxk/roc_npc_aging.c
> +++ b/drivers/common/cnxk/roc_npc_aging.c
> @@ -145,7 +145,7 @@ npc_age_wait_until(struct roc_npc_flow_age *flow_age)
>                 plt_delay_us(sleep);
>                 timeout += sleep;
>         } while (!flow_age->aged_flows_get_thread_exit &&
> -                (timeout < (flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US)));
> +                (timeout < ((uint64_t)flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US)));
>  }
>
>  uint32_t
> --
> 2.25.1
>

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

end of thread, other threads:[~2024-07-22 17:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-18  6:34 [PATCH v1] common/cnxk: fix integer overflow Ankur Dwivedi
2024-07-22 17:39 ` 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).