[PATCH v1] common/cnxk: fix integer overflow
Ankur Dwivedi
adwivedi at marvell.com
Thu Jul 18 08:34:37 CEST 2024
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 at dpdk.org
Signed-off-by: Ankur Dwivedi <adwivedi at 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
More information about the dev
mailing list