]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
cxgb4: Fix unintentional sign extension issues
authorColin Ian King <colin.king@canonical.com>
Fri, 9 Apr 2021 11:08:57 +0000 (12:08 +0100)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Mon, 24 May 2021 23:46:37 +0000 (17:46 -0600)
commit94a2af41859995362c818ff7f3ebda44526d1cfd
tree6d4ebae12a53adcd252c8f9ef2b59f04babccacc
parentc663f725b755f1fe07703e8143907741adc2780c
cxgb4: Fix unintentional sign extension issues

BugLink: https://bugs.launchpad.net/bugs/1929455
[ Upstream commit dd2c79677375c37f8f9f8d663eb4708495d595ef ]

The shifting of the u8 integers f->fs.nat_lip[] by 24 bits to
the left will be promoted to a 32 bit signed int and then
sign-extended to a u64. In the event that the top bit of the u8
is set then all then all the upper 32 bits of the u64 end up as
also being set because of the sign-extension. Fix this by
casting the u8 values to a u64 before the 24 bit left shift.

Addresses-Coverity: ("Unintended sign extension")
Fixes: 12b276fbf6e0 ("cxgb4: add support to create hash filters")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c