Skip to content

Commit c443be7

Browse files
HMS-stgrmarckleinebudde
authored andcommitted
can: peak_usb: fix shift-out-of-bounds issue
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Reported-by: Marc Kleine-Budde <[email protected]> Closes: https://lore.kernel.org/[email protected] Fixes: bb47855 ("can: usb: PEAK-System Technik USB adapters driver core") [mkl: update subject, apply manually] Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent a3ed215 commit c443be7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/can/usb/peak_usb/pcan_usb_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void peak_usb_update_ts_now(struct peak_time_ref *time_ref, u32 ts_now)
111111
u32 delta_ts = time_ref->ts_dev_2 - time_ref->ts_dev_1;
112112

113113
if (time_ref->ts_dev_2 < time_ref->ts_dev_1)
114-
delta_ts &= (1 << time_ref->adapter->ts_used_bits) - 1;
114+
delta_ts &= (1ULL << time_ref->adapter->ts_used_bits) - 1;
115115

116116
time_ref->ts_total += delta_ts;
117117
}

0 commit comments

Comments
 (0)