Re: [PATCH][next] can: usb: fix potential integer overflow on shift of a int

From: Marc Kleine-Budde
Date: Thu Nov 05 2020 - 08:07:48 EST


On 11/5/20 12:24 PM, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> 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.
>
> Addresses-Coverity: ("Unintentional integer overflow")
> Fixes: bb4785551f64 ("can: usb: PEAK-System Technik USB adapters driver core")
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>

Applied to linux-can/testing (not to next).

Thanks,
Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

Attachment: signature.asc
Description: OpenPGP digital signature