From 118ba4e3f2a39e6fc10075c680310f4cdabc1bd7 Mon Sep 17 00:00:00 2001 From: Ankur Dwivedi Date: Thu, 18 Jul 2024 12:04:37 +0530 Subject: [PATCH] common/cnxk: fix integer overflow 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 --- 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 1e85033e2a0..258c15e3418 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