From da0ad36d2e95fb029c3a14ad99a78beebc29507f Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Mon, 12 Oct 2026 14:19:35 +0200 Subject: [PATCH] efi: Initialize all configuration table addresses to EFI_INVALID_TABLE_ADDR The addresses of the MOK variable table, the confidential computing secret area and the unaccepted memory table in struct efi are only initialized to EFI_INVALID_TABLE_ADDR if support for the respective table is enabled, and are left at 0 otherwise. This is harmless for the existing users, which are compiled out in that case, but code that consumes the table addresses in struct efi generically, such as a kexec loader that passes the configuration tables on to the incoming kernel, would mistake 0 for a valid table address. So initialize all of them unconditionally: efi_config_parse_tables() only assigns them if support for the table is enabled, and so they remain EFI_INVALID_TABLE_ADDR otherwise. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/efi.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 14b9c7ebb5df..9bc22de0d67e 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -47,15 +47,9 @@ struct efi __read_mostly efi = { .tpm_final_log = EFI_INVALID_TABLE_ADDR, .ovmf_debug_log = EFI_INVALID_TABLE_ADDR, .mem_reserve = EFI_INVALID_TABLE_ADDR, -#ifdef CONFIG_LOAD_UEFI_KEYS .mokvar_table = EFI_INVALID_TABLE_ADDR, -#endif -#ifdef CONFIG_EFI_COCO_SECRET .coco_secret = EFI_INVALID_TABLE_ADDR, -#endif -#ifdef CONFIG_UNACCEPTED_MEMORY .unaccepted = EFI_INVALID_TABLE_ADDR, -#endif }; EXPORT_SYMBOL(efi);