]> git.baikalelectronics.ru Git - kernel.git/commit
igb: fix bit_shift to be in [1..8] range
authorAleksandr Loktionov <aleksandr.loktionov@intel.com>
Tue, 16 May 2023 17:41:46 +0000 (10:41 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:47 +0000 (17:32 +0100)
commitf5e17ba365885e0f93424100b0ee08d6fe949a4e
tree371be4a6dce76da9647c5d836badfe0ef3768bc1
parent40f1f1336d5c6fbdf67a794fd7083a8c2f8adc5a
igb: fix bit_shift to be in [1..8] range

[ Upstream commit 60d758659f1fb49e0d5b6ac2691ede8c0958795b ]

In igb_hash_mc_addr() the expression:
        "mc_addr[4] >> 8 - bit_shift", right shifting "mc_addr[4]"
shift by more than 7 bits always yields zero, so hash becomes not so different.
Add initialization with bit_shift = 1 and add a loop condition to ensure
bit_shift will be always in [1..8] range.

Fixes: d49a2a41710f ("igb: PCI-Express 82575 Gigabit Ethernet driver")
Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/igb/e1000_mac.c