[PATCH] fixup! bootm: give bootm_load_ functions an end address
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Feb 24 03:33:00 PST 2026
booti: fix use of uninitialized end variable
If a fixed OS load address is set, get_kernel_address() will not set end
leading to an uninitialized end value to be passed to bootm_load_os().
Fix this by determining the gap the fixed OS load address is located in
and passing that along instead.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
common/booti.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/common/booti.c b/common/booti.c
index 4f6ccf95f85c..ba7e6081e6ce 100644
--- a/common/booti.c
+++ b/common/booti.c
@@ -14,6 +14,7 @@ static unsigned long get_kernel_address(unsigned long os_address,
resource_size_t *end)
{
resource_size_t start;
+ struct resource *sdram, gap;
int ret;
if (!UIMAGE_IS_ADDRESS_VALID(os_address)) {
@@ -24,6 +25,12 @@ static unsigned long get_kernel_address(unsigned long os_address,
return ALIGN(start, SZ_2M) + text_offset;
}
+ sdram = memory_bank_lookup_region(os_address, &gap);
+ if (sdram != &gap)
+ return UIMAGE_INVALID_ADDRESS;
+
+ *end = gap.end;
+
if (os_address >= text_offset && IS_ALIGNED(os_address - text_offset, SZ_2M))
return os_address;
@@ -52,7 +59,8 @@ void *booti_load_image(struct image_data *data, phys_addr_t *oftree)
kernel = get_kernel_address(data->os_address, text_offset, &end);
- pr_debug("Kernel to be loaded to %lx+%lx\n", kernel, image_size);
+ pr_debug("Kernel (size: %lx) to be loaded into %lx+%llx\n",
+ image_size, kernel, end);
if (kernel == UIMAGE_INVALID_ADDRESS)
return ERR_PTR(-ENOENT);
--
2.47.3
More information about the barebox
mailing list