[PATCH master 12/39] efi: loader: fix return type and memory leak in efi_smbios_register
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Feb 16 00:44:12 PST 2026
The function returns efi_status_t but returned -EINVAL (a POSIX error
code) on SMBIOS table write failure. Additionally, the EFI pages
allocated for the table were leaked on this error path.
Return EFI_LOAD_ERROR and free the allocated pages.
Co-Authored-By: Claude Opus 4.6 <noreply at anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
efi/loader/smbios.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/efi/loader/smbios.c b/efi/loader/smbios.c
index 81ba77c24017..d8a708978e11 100644
--- a/efi/loader/smbios.c
+++ b/efi/loader/smbios.c
@@ -40,7 +40,8 @@ static efi_status_t efi_smbios_register(void *data)
if (!write_smbios_table(buf)) {
pr_err("Failed to write SMBIOS table\n");
- return -EINVAL;
+ efi_free_pages(memory, efi_size_in_pages(TABLE_SIZE));
+ return EFI_LOAD_ERROR;
}
/* Install SMBIOS information as configuration table */
--
2.47.3
More information about the barebox
mailing list