Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34529 )
Change subject: soc/nvidia/tegra210: Prevent implicit integer promotion ......................................................................
soc/nvidia/tegra210: Prevent implicit integer promotion
The perennial problem with u16 << 16 strikes again - the u16 is implicitly promoted to an int before the shift, which will then have undefined behaviour if the highest bit of the u16 was set. Cast bytes to a u32 beforehand to prevent this.
Change-Id: Iaf0fb1040ccafafde0093e9bb192c802b86cb2ac Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 1294800 --- M src/soc/nvidia/tegra210/dsi.c 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/29/34529/1
diff --git a/src/soc/nvidia/tegra210/dsi.c b/src/soc/nvidia/tegra210/dsi.c index ae20d44..6b94e24 100644 --- a/src/soc/nvidia/tegra210/dsi.c +++ b/src/soc/nvidia/tegra210/dsi.c @@ -380,8 +380,8 @@ }
tegra_dsi_writel(dsi, 0, DSI_PKT_LEN_0_1); - tegra_dsi_writel(dsi, bytes << 16, DSI_PKT_LEN_2_3); - tegra_dsi_writel(dsi, bytes << 16, DSI_PKT_LEN_4_5); + tegra_dsi_writel(dsi, (u32)bytes << 16, DSI_PKT_LEN_2_3); + tegra_dsi_writel(dsi, (u32)bytes << 16, DSI_PKT_LEN_4_5); tegra_dsi_writel(dsi, 0, DSI_PKT_LEN_6_7);
value = MIPI_DCS_WRITE_MEMORY_START << 8 |