Skip to content

Commit

Permalink
x86/efi: Check krealloc return value
Browse files Browse the repository at this point in the history
Check it just in case. We might just as well panic there because runtime
won't be functioning anyway.

Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
  • Loading branch information
Borislav Petkov authored and Matt Fleming committed Nov 2, 2013
1 parent d2f7cbe commit ee41143
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/x86/platform/efi/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,9 @@ void __init efi_enter_virtual_mode(void)
new_memmap = krealloc(new_memmap,
(count + 1) * memmap.desc_size,
GFP_KERNEL);
if (!new_memmap)
goto err_out;

memcpy(new_memmap + (count * memmap.desc_size), md,
memmap.desc_size);
count++;
Expand Down Expand Up @@ -914,6 +917,11 @@ void __init efi_enter_virtual_mode(void)
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
0, NULL);

return;

err_out:
pr_err("Error reallocating memory, EFI runtime non-functional!\n");
}

/*
Expand Down

0 comments on commit ee41143

Please sign in to comment.