Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/34524 )
Change subject: soc/rockchip/rk3399: Use 64 bits in multiplication ......................................................................
soc/rockchip/rk3399: Use 64 bits in multiplication
This multiplication is of the form u64 = u32 * u32. Despite being stored in a 64 bit variable, the intermediate value is still calculated using 32 bit math, which could possibly overflow. Cast one of the variables to a u64 to ensure it uses 64 bit math instead to avoid this.
Change-Id: Ib08624812e933fdca5a51150ab36d3be49383326 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 1375443 Reviewed-on: https://review.coreboot.org/c/coreboot/+/34524 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Julius Werner jwerner@chromium.org Reviewed-by: Paul Menzel paulepanter@users.sourceforge.net --- M src/soc/rockchip/rk3399/mipi.c 1 file changed, 1 insertion(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Paul Menzel: Looks good to me, but someone else must approve Julius Werner: Looks good to me, approved
diff --git a/src/soc/rockchip/rk3399/mipi.c b/src/soc/rockchip/rk3399/mipi.c index 1f3f02c..8b80bd7 100644 --- a/src/soc/rockchip/rk3399/mipi.c +++ b/src/soc/rockchip/rk3399/mipi.c @@ -305,7 +305,7 @@ dsi->format); return bpp; } - pclk = edid->mode.pixel_clock * MSECS_PER_SEC; + pclk = (u64)edid->mode.pixel_clock * MSECS_PER_SEC;
/* take 1 / 0.8, since mbps must bigger than bandwidth of RGB */ target_bps = pclk / panel_data->lanes * bpp / 8 * 10;