summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2013-04-10 10:59:34 +0200
committerMatt Fleming <matt.fleming@intel.com>2013-04-11 15:45:52 +0100
commit7791c8423f1f7f4dad94e753bae67461d5b80be8 (patch)
tree54b619a807a75adef8551f1db76250b22b151f8f /arch
parenta6e4d5a03e9e3587e88aba687d8f225f4f04c792 (diff)
downloadlinux-7791c8423f1f7f4dad94e753bae67461d5b80be8.tar.gz
linux-7791c8423f1f7f4dad94e753bae67461d5b80be8.tar.bz2
linux-7791c8423f1f7f4dad94e753bae67461d5b80be8.zip
x86,efi: Check max_size only if it is non-zero.
Some EFI implementations return always a MaximumVariableSize of 0, check against max_size only if it is non-zero. My Intel DQ67SW desktop board has such an implementation. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/platform/efi/efi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index c89c245eff40..3f96a487aa2a 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -1018,7 +1018,12 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
if (status != EFI_SUCCESS)
return status;
- if (!storage_size || size > remaining_size || size > max_size ||
+ if (!max_size && remaining_size > size)
+ printk_once(KERN_ERR FW_BUG "Broken EFI implementation"
+ " is returning MaxVariableSize=0\n");
+
+ if (!storage_size || size > remaining_size ||
+ (max_size && size > max_size) ||
(remaining_size - size) < (storage_size / 2))
return EFI_OUT_OF_RESOURCES;