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>
This commit is contained in:
Jacob Garber 2019-07-23 11:55:04 -06:00 committed by Patrick Georgi
parent 17887d08fe
commit e24585c834
1 changed files with 1 additions and 1 deletions

View File

@ -305,7 +305,7 @@ static int rk_mipi_dsi_get_lane_bps(struct rk_mipi_dsi *dsi,
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;