From c193d9bd284565df4ddcdd1e9190d2ce718e9eb7 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 15 May 2021 18:07:47 +0200 Subject: 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 Reviewed-by: Simon Glass --- arch/x86/lib/tables.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c index 1779bb3e11..ea834a5035 100644 --- a/arch/x86/lib/tables.c +++ b/arch/x86/lib/tables.c @@ -3,6 +3,8 @@ * Copyright (C) 2015, Bin Meng */ +#define LOG_CATEGORY LOGC_BOARD + #include #include #include @@ -96,13 +98,20 @@ int write_tables(void) return log_msg_ret("bloblist", -ENOBUFS); } rom_table_end = table->write(rom_table_start); - rom_table_end = ALIGN(rom_table_end, ROM_TABLE_ALIGN); + if (!rom_table_end) { + log_err("Can't create configuration table %d\n", i); + return -EINTR; + } if (IS_ENABLED(CONFIG_SEABIOS)) { table_size = rom_table_end - rom_table_start; high_table = (u32)(ulong)high_table_malloc(table_size); if (high_table) { - table->write(high_table); + if (!table->write(high_table)) { + log_err("Can't create configuration table %d\n", + i); + return -EINTR; + } cfg_tables[i].start = high_table; cfg_tables[i].size = table_size; -- cgit v1.2.3