2021-01-11 18:12:14

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH] drm/bridge: nwl-dsi: Avoid potential multiplication overflow on 32-bit

Hi Geert,

On Mon, Jan 11, 2021 at 10:02 AM Geert Uytterhoeven
<[email protected]> wrote:
>
> As nwl_dsi.lanes is u32, and NSEC_PER_SEC is 1000000000L, the second
> multiplication in
>
> dsi->lanes * 8 * NSEC_PER_SEC
>
> will overflow on a 32-bit platform. Fix this by making the constant
> unsigned long long, forcing 64-bit arithmetic.
>
> While iMX8 is arm64, this driver is currently used on 64-bit platforms
> only, where long is 64-bit, so this cannot happen. But the issue may
> start to happen when the driver is reused for a 32-bit SoC, or when code
> is copied for a new driver.

This IP is also present on i.MX7ULP, which is 32-bit, but not supported yet.

Thanks for taking care of this.

Reviewed-by: Fabio Estevam <[email protected]>