]> 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:39:01 +0000 (13:39 +0100)
commit2dce84cc58d4e8eebc2a5dc6c0beebad2068c302
treeaaf6f4007637e33e1c50596a8211f7305eb53f09
parent28b801f283c0a8d1fbe4d3fbee6fe5ab56e977a2
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