]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
can: peak_usb: fix potential integer overflow on shift of a int
authorColin Ian King <colin.king@canonical.com>
Thu, 5 Nov 2020 11:24:27 +0000 (11:24 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Nov 2020 12:27:22 +0000 (13:27 +0100)
commit0069f22dc29ec971161c22b79516c998d01852bb
tree21b77e37af95dfc8cf5fb995d2864be4ce5c4b2c
parent6521ffa41b5b6e59dd72a502bdbea507a8d287a2
can: peak_usb: fix potential integer overflow on shift of a int

[ Upstream commit 8a68cc0d690c9e5730d676b764c6f059343b842c ]

The left shift of int 32 bit integer constant 1 is evaluated using 32 bit
arithmetic and then assigned to a signed 64 bit variable. In the case where
time_ref->adapter->ts_used_bits is 32 or more this can lead to an oveflow.
Avoid this by shifting using the BIT_ULL macro instead.

Fixes: bb4785551f64 ("can: usb: PEAK-System Technik USB adapters driver core")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20201105112427.40688-1-colin.king@canonical.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/can/usb/peak_usb/pcan_usb_core.c