]> git.baikalelectronics.ru Git - kernel.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)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Sun, 15 Nov 2020 17:24:35 +0000 (18:24 +0100)
commitca74002e85c7ca2996eb93d7998a21d3cd03dc2c
treeaa4f38431a99345738a83b5b880ba2110c3be39c
parent31ce4a40b12c089c7dca1ee2e96fdf040398e26a
can: peak_usb: fix potential integer overflow on shift of a int

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: 8febc5029b0c ("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>
drivers/net/can/usb/peak_usb/pcan_usb_core.c