]> Git Repo - linux.git/commitdiff
x86/efi: Check krealloc return value
authorBorislav Petkov <[email protected]>
Thu, 31 Oct 2013 16:25:09 +0000 (17:25 +0100)
committerMatt Fleming <[email protected]>
Sat, 2 Nov 2013 11:09:36 +0000 (11:09 +0000)
Check it just in case. We might just as well panic there because runtime
won't be functioning anyway.

Signed-off-by: Borislav Petkov <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
arch/x86/platform/efi/efi.c

index b453069236fd062f100cdf17ac0041b802ae89f3..3fac4dee492fd6f3fa88ea9c1df4197665570537 100644 (file)
@@ -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");
 }
 
 /*
This page took 0.056658 seconds and 4 git commands to generate.