]> git.baikalelectronics.ru Git - kernel.git/commit
net: thunderx: Fix unintentional sign extension issue
authorColin Ian King <colin.king@canonical.com>
Fri, 9 Apr 2021 13:07:26 +0000 (14:07 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Apr 2021 20:13:57 +0000 (13:13 -0700)
commitc764e71cd465a03007bde117229d8d22e945c9e0
treef76ccaed5c82dfa885e96df8a450dee81ad3f53d
parentff9e9ec6cfda7731cb02c424b62e350801c952b9
net: thunderx: Fix unintentional sign extension issue

The shifting of the u8 integers rq->caching by 26 bits to
the left will be promoted to a 32 bit signed int and then
sign-extended to a u64. In the event that rq->caching is
greater than 0x1f then all then all the upper 32 bits of
the u64 end up as also being set because of the int
sign-extension. Fix this by casting the u8 values to a
u64 before the 26 bit left shift.

Addresses-Coverity: ("Unintended sign extension")
Fixes: 55a65876deb0 ("net: Adding support for Cavium ThunderX network controller")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/thunder/nicvf_queues.c