cxgb4: Fix unintentional sign extension issues
authorColin Ian King <colin.king@canonical.com>
Fri, 9 Apr 2021 11:08:57 +0000 (12:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Apr 2021 20:13:17 +0000 (13:13 -0700)
commitdd2c79677375c37f8f9f8d663eb4708495d595ef
treede9b82d17c3dd3cb7fc9619f651e8617aeb1f487
parent5b489fea977c2b23e26e2f630478da0f4bfdc879
cxgb4: Fix unintentional sign extension issues

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>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c