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)
committerDavid S. Miller <davem@davemloft.net>
Thu, 17 Jan 2019 19:27:00 +0000 (11:27 -0800)
commitcb12d72b27a6f41325ae23a11033cf5fedfa1b97
tree766c9eab37443392f4603bc802e8fe88c960830f
parent0f149c9fec3cd720628ecde83bfc6f64c1e7dcb6
atm: he: fix sign-extension overflow on large shift

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