From df5807658026e7b18493a6c8ebf0e47adee26b4d Mon Sep 17 00:00:00 2001 From: Steve Yang Date: Fri, 25 Feb 2022 02:39:47 +0000 Subject: [PATCH] net/i40e: fix unintentional integer overflow Cast 1 to type uint64_t to avoid overflow. CID 375812 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN) overflow_before_widen: Potentially overflowing expression 1 << 2 * i + 1 with type int (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type uint64_t (64 bits, unsigned). Coverity issue: 375812 Fixes: 5fec01c35c49 ("net/i40e: support Linux VF to configure IRQ link list") Cc: stable@dpdk.org Signed-off-by: Steve Yang Reviewed-by: Ferruh Yigit --- drivers/net/i40e/i40e_pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 2435a8a070..15d9ff868f 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -597,14 +597,14 @@ i40e_pf_config_irq_link_list(struct i40e_pf_vf *vf, tempmap = vvm->rxq_map; for (i = 0; i < sizeof(vvm->rxq_map) * BITS_PER_CHAR; i++) { if (tempmap & 0x1) - linklistmap |= (1 << (2 * i)); + linklistmap |= RTE_BIT64(2 * i); tempmap >>= 1; } tempmap = vvm->txq_map; for (i = 0; i < sizeof(vvm->txq_map) * BITS_PER_CHAR; i++) { if (tempmap & 0x1) - linklistmap |= (1 << (2 * i + 1)); + linklistmap |= RTE_BIT64(2 * i + 1); tempmap >>= 1; }