Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Richard Weinberger and committed by
Matt Fleming
7791c842 a6e4d5a0

+6 -1
+6 -1
arch/x86/platform/efi/efi.c
··· 1018 1018 if (status != EFI_SUCCESS) 1019 1019 return status; 1020 1020 1021 - if (!storage_size || size > remaining_size || size > max_size || 1021 + if (!max_size && remaining_size > size) 1022 + printk_once(KERN_ERR FW_BUG "Broken EFI implementation" 1023 + " is returning MaxVariableSize=0\n"); 1024 + 1025 + if (!storage_size || size > remaining_size || 1026 + (max_size && size > max_size) || 1022 1027 (remaining_size - size) < (storage_size / 2)) 1023 1028 return EFI_OUT_OF_RESOURCES; 1024 1029