]> git.baikalelectronics.ru Git - 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)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Apr 2021 20:13:17 +0000 (13:13 -0700)
commitff9e9ec6cfda7731cb02c424b62e350801c952b9
treede9b82d17c3dd3cb7fc9619f651e8617aeb1f487
parent1f7d6bb2ef931dd434e0c452ca2d19a8c8ff654a
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: 8d82304a0d36 ("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