atm: he: fix sign-extension overflow on large shift
authorColin Ian King <colin.king@canonical.com>
Tue, 15 Jan 2019 18:03:38 +0000 (18:03 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Feb 2019 09:08:57 +0000 (10:08 +0100)
commite0d7b0a2a57adbd0f33a280f6628a9c4d7a87c92
treee00123c4ed46d3385f85696f5873d3f4a5aec888
parent22b304bfcb009c847ff920893c317ff863ab504a
atm: he: fix sign-extension overflow on large shift

[ Upstream commit cb12d72b27a6f41325ae23a11033cf5fedfa1b97 ]

Shifting the 1 by exp by an int can lead to sign-extension overlow when
exp is 31 since 1 is an signed int and sign-extending this result to an
unsigned long long will set the upper 32 bits.  Fix this by shifting an
unsigned long.

Detected by cppcheck:
(warning) Shifting signed 32-bit value by 31 bits is undefined behaviour

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>
drivers/atm/he.c