Skip to content

Commit

Permalink
common/cnxk: fix integer overflow
Browse files Browse the repository at this point in the history
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: a487829 ("common/cnxk: fix flow aging on application exit")
Cc: stable@dpdk.org

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
  • Loading branch information
adwivedi7 authored and jerinjacobk committed Jul 22, 2024
1 parent fa8d2f7 commit 781d698
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/common/cnxk/roc_npc_aging.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 781d698

Please sign in to comment.