board: toradex: verdin-imx95: fix ram size check calculated addresses
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.
--- board/toradex/verdin-imx95/verdin-imx95.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
board/toradex/verdin-imx95/verdin-imx95.c +4 -4
@@ -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
Quoted 10 lines · Emanuele Ghidoli
From: Emanuele Ghidoli <[email protected]>
The
ram_alias_checksaddresses 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_trecast to the base address.Fixes 60d8255d8dc0 ("board: toradex: add Toradex Verdin iMX95")Signed-off-by Emanuele Ghidoli <[email protected]>
Fabio Estevam
reviewerQuoted 11 lines · Emanuele Ghidoli
From: Emanuele Ghidoli <[email protected]>
The
ram_alias_checksaddresses 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_trecast to the base address.Fixes 60d8255d8dc0 ("board: toradex: add Toradex Verdin iMX95")Signed-off-by Emanuele Ghidoli <[email protected]>
Applied to u-boot-imx/master, thanks.