[v1,12/24] net/igc/base: fix data type in MAC hash
Checks
Commit Message
From: Barbara Skobiej <barbara.skobiej@intel.com>
One of the bit shifts in MAC hash calculation triggers a static analysis
warning about a potential overflow. Fix the data type to avoid this.
Fixes: 8cb7c57d9b3c ("net/igc: support device initialization")
Cc: stable@dpdk.org
Signed-off-by: Barbara Skobiej <barbara.skobiej@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
drivers/net/intel/igc/base/igc_mac.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
@@ -539,8 +539,10 @@ u32 igc_hash_mc_addr_generic(struct igc_hw *hw, u8 *mc_addr)
break;
}
- hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
- (((u16)mc_addr[5]) << bit_shift)));
+ hash_value = (u32)mc_addr[4];
+ hash_value = hash_value >> (8 - bit_shift);
+ hash_value |= (((u32)mc_addr[5]) << bit_shift);
+ hash_value &= hash_mask;
return hash_value;
}