Skip to contentSkip to conversation

board: toradex: verdin-imx95: fix ram size check calculated addresses

PATCH In review Emanuele Ghidoli 3 participants 3 messages May 20 – Jun 5 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board: toradex: verdin-imx95: fix ram size check calculated addresses

From: Emanuele Ghidoli <[email protected]>

The ram_alias_checks addresses are 32 bit values. When summed as 64 bit values the calculation is done correctly, otherwise, if they are summed as 32 bit values, the sum wraps around.

Fix by adding uintptr_t recast to the base address.

Fixes 60d8255d8dc0 ("board: toradex: add Toradex Verdin iMX95")
---
 board/toradex/verdin-imx95/verdin-imx95.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
board/toradex/verdin-imx95/verdin-imx95.c +4 -4
index 60c1dbb5e294..7c0804c1d1ce 100644
@@ -50,10 +50,10 @@ int board_late_init(void)
 }
 
 static const struct ram_alias_check ram_alias_checks[] = {
-	{ (void *)(PHYS_SDRAM + SZ_8G), (void *)(PHYS_SDRAM), SZ_16G },
-	{ (void *)(PHYS_SDRAM + SZ_4G), (void *)(PHYS_SDRAM), SZ_8G },
-	{ (void *)(PHYS_SDRAM + SZ_2G), (void *)(PHYS_SDRAM), SZ_4G },
-	{ (void *)(PHYS_SDRAM + SZ_1G), (void *)(PHYS_SDRAM), SZ_2G },
+	{ (void *)((uintptr_t)PHYS_SDRAM + SZ_8G), (void *)(PHYS_SDRAM), SZ_16G },
+	{ (void *)((uintptr_t)PHYS_SDRAM + SZ_4G), (void *)(PHYS_SDRAM), SZ_8G },
+	{ (void *)((uintptr_t)PHYS_SDRAM + SZ_2G), (void *)(PHYS_SDRAM), SZ_4G },
+	{ (void *)((uintptr_t)PHYS_SDRAM + SZ_1G), (void *)(PHYS_SDRAM), SZ_2G },
 	{ NULL }
 };
 
Signature · 1 line
2.43.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

The ram_alias_checks addresses are 32 bit values. When summed as 64 bit values the calculation is done correctly, otherwise, if they are summed as 32 bit values, the sum wraps around.

Fix by adding uintptr_t recast to the base address.

Fixes 60d8255d8dc0 ("board: toradex: add Toradex Verdin iMX95")
reviewer
#2 lore raw
In reply to Emanuele Ghidoli
Quoted 11 lines · Emanuele Ghidoli

From: Emanuele Ghidoli <[email protected]>

The ram_alias_checks addresses are 32 bit values. When summed as 64 bit values the calculation is done correctly, otherwise, if they are summed as 32 bit values, the sum wraps around.

Fix by adding uintptr_t recast to the base address.

Fixes 60d8255d8dc0 ("board: toradex: add Toradex Verdin iMX95")

Applied to u-boot-imx/master, thanks.