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:06:59 +0000 (10:06 +0100)
commit364f3761461395230ee45ed54c1962649df9e640
tree1999ff4f1a6fe492f4da53a73645333001d8d9a9
parent46154d295b82ff4f470dd3934440433ce333825b
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