mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
can: peak_usb: fix shift-out-of-bounds issue
[ Upstream commit c443be70aaee42c2d1d251e0329e0a69dd96ae54 ]
Explicitly uses a 64-bit constant when the number of bits used for its
shifting is 32 (which is the case for PC CAN FD interfaces supported by
this driver).
Signed-off-by: Stéphane Grosjean <stephane.grosjean@hms-networks.com>
Link: https://patch.msgid.link/20250918132413.30071-1-stephane.grosjean@free.fr
Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
Closes: https://lore.kernel.org/20250917-aboriginal-refined-honeybee-82b1aa-mkl@pengutronix.de
Fixes: bb4785551f ("can: usb: PEAK-System Technik USB adapters driver core")
[mkl: update subject, apply manually]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3664ae91b2
commit
17edec1830
@@ -111,7 +111,7 @@ void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now)
|
||||
u32 delta_ts = time_ref->ts_dev_2 - time_ref->ts_dev_1;
|
||||
|
||||
if (time_ref->ts_dev_2 < time_ref->ts_dev_1)
|
||||
delta_ts &= (1 << time_ref->adapter->ts_used_bits) - 1;
|
||||
delta_ts &= (1ULL << time_ref->adapter->ts_used_bits) - 1;
|
||||
|
||||
time_ref->ts_total += delta_ts;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user