aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_loader
diff options
context:
space:
mode:
authorHeinrich Schuchardt2021-05-15 18:07:47 +0200
committerHeinrich Schuchardt2021-07-24 10:49:51 +0200
commitc193d9bd284565df4ddcdd1e9190d2ce718e9eb7 (patch)
treeaad6c530d29fcb91f35e632e8237c43fb4f73b16 /lib/efi_loader
parent11275e4f72d6d2170db444df95e8f6b6ab627e8e (diff)
smbios: error handling for invalid addresses
SMBIOS tables only support 32bit addresses. If we don't have memory here handle the error gracefully: * on x86_64 fail to start U-Boot * during UEFI booting ignore the missing table Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/efi_loader')
-rw-r--r--lib/efi_loader/efi_smbios.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c
index 719d3e8880a..2eb4cb1c1af 100644
--- a/lib/efi_loader/efi_smbios.c
+++ b/lib/efi_loader/efi_smbios.c
@@ -5,6 +5,8 @@
* Copyright (c) 2016 Alexander Graf
*/
+#define LOG_CATEGORY LOGC_EFI
+
#include <common.h>
#include <efi_loader.h>
#include <log.h>
@@ -43,14 +45,13 @@ efi_status_t efi_smbios_register(void)
* Generate SMBIOS tables - we know that efi_allocate_pages() returns
* a 4k-aligned address, so it is safe to assume that
* write_smbios_table() will write the table at that address.
- *
- * Note that on sandbox, efi_allocate_pages() unfortunately returns a
- * pointer even though it uses a uint64_t type. Convert it.
*/
assert(!(dmi_addr & 0xf));
dmi = (void *)(uintptr_t)dmi_addr;
- write_smbios_table(map_to_sysmem(dmi));
-
- /* And expose them to our EFI payload */
- return efi_install_configuration_table(&smbios_guid, dmi);
+ if (write_smbios_table(map_to_sysmem(dmi)))
+ /* Install SMBIOS information as configuration table */
+ return efi_install_configuration_table(&smbios_guid, dmi);
+ efi_free_pages(dmi_addr, 1);
+ log_err("Cannot create SMBIOS table\n");
+ return EFI_SUCCESS;
}