Commit b12bcd7b authored by Richard Weinberger's avatar Richard Weinberger Committed by Ben Hutchings

x86,efi: Check max_size only if it is non-zero.

commit 7791c842 upstream.

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: default avatarRichard Weinberger <richard@nod.at>
Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent c5ba30a7
...@@ -834,7 +834,12 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size) ...@@ -834,7 +834,12 @@ efi_status_t efi_query_variable_store(u32 attributes, unsigned long size)
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS)
return status; 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)) (remaining_size - size) < (storage_size / 2))
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment