Skip to content

Commit 217c0a5

Browse files
rpptardbiesheuvel
authored andcommitted
x86/efi: efi_unmap_boot_services: fix calculation of ranges_to_free size
ranges_to_free array should have enough room to store the entire EFI memmap plus an extra element for NULL entry. The calculation of this array size wrongly adds 1 to the overall size instead of adding 1 to the number of elements. Add parentheses to properly size the array. Reported-by: Guenter Roeck <[email protected]> Fixes: a4b0bf6 ("x86/efi: defer freeing of boot services memory") Signed-off-by: Mike Rapoport (Microsoft) <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent a4b0bf6 commit 217c0a5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/x86/platform/efi/quirks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ void __init efi_unmap_boot_services(void)
424424
if (efi_enabled(EFI_DBG))
425425
return;
426426

427-
sz = sizeof(*ranges_to_free) * efi.memmap.nr_map + 1;
427+
sz = sizeof(*ranges_to_free) * (efi.memmap.nr_map + 1);
428428
ranges_to_free = kzalloc(sz, GFP_KERNEL);
429429
if (!ranges_to_free) {
430430
pr_err("Failed to allocate storage for freeable EFI regions\n");

0 commit comments

Comments
 (0)