Skip to content

Commit 59365ca

Browse files
ardbiesheuvelIngo Molnar
authored andcommitted
efi/x86: Fix boot regression on systems with invalid memmap entries
In efi_clean_memmap(), we do a pass over the EFI memory map to remove bogus entries that may be returned on certain systems. This recent commit: 1db9103 ("efi: Add tracking for dynamically allocated memmaps") refactored this code to pass the input to efi_memmap_install() via a temporary struct on the stack, which is populated using an initializer which inadvertently defines the value of its size field in terms of its desc_size field, which value cannot be relied upon yet in the initializer itself. Fix this by using efi.memmap.desc_size instead, which is where we get the value for desc_size from in the first place. Reported-by: Jörg Otte <[email protected]> Tested-by: Jörg Otte <[email protected]> Tested-by: Dan Williams <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent b3a6082 commit 59365ca

File tree

1 file changed

+1
-1
lines changed
  • arch/x86/platform/efi

1 file changed

+1
-1
lines changed

arch/x86/platform/efi/efi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static void __init efi_clean_memmap(void)
308308
.phys_map = efi.memmap.phys_map,
309309
.desc_version = efi.memmap.desc_version,
310310
.desc_size = efi.memmap.desc_size,
311-
.size = data.desc_size * (efi.memmap.nr_map - n_removal),
311+
.size = efi.memmap.desc_size * (efi.memmap.nr_map - n_removal),
312312
.flags = 0,
313313
};
314314

0 commit comments

Comments
 (0)