summaryrefslogtreecommitdiffstats
path: root/arch/x86/platform
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2013-10-31 17:25:09 +0100
committerMatt Fleming <matt.fleming@intel.com>2013-11-02 12:09:36 +0100
commitee41143027706d9f342dfe05487a00b20887fde7 (patch)
tree2e4a0bf717d2e171b562b177f5571c5b8659d48b /arch/x86/platform
parentx86/efi: Runtime services virtual mapping (diff)
downloadlinux-ee41143027706d9f342dfe05487a00b20887fde7.tar.xz
linux-ee41143027706d9f342dfe05487a00b20887fde7.zip
x86/efi: Check krealloc return value
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>
Diffstat (limited to 'arch/x86/platform')
-rw-r--r--arch/x86/platform/efi/efi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index b453069236fd..3fac4dee492f 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -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++;
@@ -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");
}
/*