* [PATCH] efi: payload: do not check for heap addresses in efi_load_image
@ 2025-10-23 6:59 Ahmad Fatoum
2025-10-23 7:44 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-10-23 6:59 UTC (permalink / raw)
To: barebox; +Cc: Chali Anis, Ahmad Fatoum
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@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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] efi: payload: do not check for heap addresses in efi_load_image
2025-10-23 6:59 [PATCH] efi: payload: do not check for heap addresses in efi_load_image Ahmad Fatoum
@ 2025-10-23 7:44 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-10-23 7:44 UTC (permalink / raw)
To: barebox, Ahmad Fatoum; +Cc: Chali Anis
On Thu, 23 Oct 2025 08:59:06 +0200, Ahmad Fatoum wrote:
> 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.
>
>
> [...]
Applied, thanks!
[1/1] efi: payload: do not check for heap addresses in efi_load_image
https://git.pengutronix.de/cgit/barebox/commit/?id=8f4c5606e201 (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-23 7:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-23 6:59 [PATCH] efi: payload: do not check for heap addresses in efi_load_image Ahmad Fatoum
2025-10-23 7:44 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox