boot: fdt: Change type of env_get_bootm_low() to phys_addr_t
Change type of ulong env_get_bootm_low() to phys_addr_t env_get_bootm_low().
The PPC/LS systems already treat env_get_bootm_low() result as phys_addr_t,
while the function itself still returns ulong. This is potentially dangerous
on 64bit systems, where ulong might not be large enough to hold the content
of "bootm_low" environment variable. Fix it by using phys_addr_t, similar to
what env_get_bootm_size() does, which returns phys_size_t .
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
diff --git a/boot/image-fdt.c b/boot/image-fdt.c
index 5e4aa9d..c2571b2 100644
--- a/boot/image-fdt.c
+++ b/boot/image-fdt.c
@@ -160,9 +160,10 @@
{
void *fdt_blob = *of_flat_tree;
void *of_start = NULL;
- u64 start, size, usable;
+ phys_addr_t start, size, usable;
char *fdt_high;
- ulong mapsize, low;
+ phys_addr_t low;
+ phys_size_t mapsize;
ulong of_len = 0;
int bank;
int err;
@@ -217,7 +218,7 @@
if (start + size < low)
continue;
- usable = min(start + size, (u64)(low + mapsize));
+ usable = min(start + size, low + mapsize);
/*
* At least part of this DRAM bank is usable, try
@@ -233,7 +234,7 @@
* Reduce the mapping size in the next bank
* by the size of attempt in current bank.
*/
- mapsize -= usable - max(start, (u64)low);
+ mapsize -= usable - max(start, low);
if (!mapsize)
break;
}