[PATCH v4 10/19] efi/libstub: arm: Simplify handle_kernel_image()
Ard Biesheuvel
ardb+git at google.com
Wed Nov 18 10:21:16 PST 2026
From: Ard Biesheuvel <ardb at kernel.org>
Now that ARM moved to efi_image_info for obtaining the base of the
decompressed kernel image in efi_enter_kernel(), it no longer needs to
distinguish between the image address (which might point into an
unrelated allocation below the decompressed image) and the reservation
address (which is what can be freed upon an error).
So use image_addr/image_size rather than reserve_addr/reserve_size in
handle_kernel_image() to return the base and size of the allocated
region to the caller. This will allow those parameters to be dropped
entirely from the prototype in a subsequent patch.
Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
---
drivers/firmware/efi/libstub/arm32-stub.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/firmware/efi/libstub/arm32-stub.c b/drivers/firmware/efi/libstub/arm32-stub.c
index 798b2ae3bb03..55d4fa3177a9 100644
--- a/drivers/firmware/efi/libstub/arm32-stub.c
+++ b/drivers/firmware/efi/libstub/arm32-stub.c
@@ -128,18 +128,14 @@ efi_status_t handle_kernel_image(unsigned long *image_addr,
efistub_image_info._text_offset =
kernel_base + TEXT_OFFSET - (u32)&efistub_image_info;
- *reserve_addr = kernel_base + slack;
- *reserve_size = alloc_size;
+ kernel_base += slack;
/* now free the parts that we will not use */
- efi_free(*reserve_addr - alloc_base, alloc_base); /* no-op if 0 */
- efi_free(alloc_base + margin - *reserve_addr, *reserve_addr + alloc_size);
+ efi_free(kernel_base - alloc_base, alloc_base); /* no-op if 0 */
+ efi_free(alloc_base + margin - kernel_base, kernel_base + alloc_size);
- *image_addr = kernel_base + TEXT_OFFSET;
- *image_size = 0;
-
- efi_debug("image addr == 0x%lx, reserve_addr == 0x%lx\n",
- *image_addr, *reserve_addr);
+ *image_addr = kernel_base;
+ *image_size = alloc_size;
return EFI_SUCCESS;
}
--
2.56.1.708.g77570a6a1d-goog
More information about the linux-riscv
mailing list