git: 3fc1786aa2a3 - main - igc: fix data type in MAC hash

Kevin Bowling <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a7b8d54.37eb1.54c33ccb__10617.6263930806$1786482168$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by kbowling:

URL: https://cgit.FreeBSD.org/src/commit/?id=3fc1786aa2a3f590453abb6ea2351a12e19f6b45

commit 3fc1786aa2a3f590453abb6ea2351a12e19f6b45
Author:     Barbara Skobiej <[email protected]>
AuthorDate: 2026-08-11 19:34:13 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-08-11 20:59:32 +0000

    igc: fix data type in MAC hash
    
    DPDK commit message
    
    net/e1000/base: fix data type in MAC hash
    
    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: af75078fece3 ("first public release")
    Cc: [email protected]
    
    Signed-off-by: Barbara Skobiej <[email protected]>
    Signed-off-by: Anatoly Burakov <[email protected]>
    Acked-by: Bruce Richardson <[email protected]>
    
    Obtained from:  DPDK (458734aaac)
    MFC after:      2 weeks
---
 sys/dev/igc/igc_mac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/dev/igc/igc_mac.c b/sys/dev/igc/igc_mac.c
index 2c32f0c7a606..add6a7327ab6 100644
--- a/sys/dev/igc/igc_mac.c
+++ b/sys/dev/igc/igc_mac.c
@@ -354,8 +354,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 >>= 8 - bit_shift;
+	hash_value |= (u32)mc_addr[5] << bit_shift;
+	hash_value &= hash_mask;
 
 	return hash_value;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.