[PATCH] efi: payload: do not check for heap addresses in efi_load_image
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Oct 22 23:59:06 PDT 2025
We used to request memory from EFI only if read_file fails, but now that
read_file has been removed from efi_read_file, only EFI memory is used.
The check in efi_free_file for heap addresses thus serves no purpose any
longer and can be dropped.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
efi/payload/image.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/efi/payload/image.c b/efi/payload/image.c
index ae7678188d84..5d20221a135e 100644
--- a/efi/payload/image.c
+++ b/efi/payload/image.c
@@ -61,16 +61,6 @@ static void *efi_read_file(const char *file, size_t *size)
return buf;
}
-static void efi_free_file(void *_mem, size_t size)
-{
- efi_physical_addr_t mem = efi_virt_to_phys(_mem);
-
- if (mem_malloc_start() <= mem && mem < mem_malloc_end())
- free(_mem);
- else
- BS->free_pages(mem, DIV_ROUND_UP(size, EFI_PAGE_SIZE));
-}
-
int efi_load_image(const char *file, struct efi_loaded_image **loaded_image,
efi_handle_t *h)
{
@@ -101,7 +91,7 @@ int efi_load_image(const char *file, struct efi_loaded_image **loaded_image,
*h = handle;
out:
- efi_free_file(exe, size);
+ BS->free_pages(efi_virt_to_phys(exe), DIV_ROUND_UP(size, EFI_PAGE_SIZE));
return -efi_errno(efiret);
}
--
2.47.3
More information about the barebox
mailing list