]> git.baikalelectronics.ru Git - kernel.git/commit
efi/libstub: Fix allocation size calculations
authorRoy Franz <roy.franz@hpe.com>
Sat, 12 Nov 2016 21:32:29 +0000 (21:32 +0000)
committerIngo Molnar <mingo@kernel.org>
Sun, 13 Nov 2016 07:23:14 +0000 (08:23 +0100)
commit8e8908af34a37894e61f90dc9157b479691d8738
tree10c1f005a2b21c1c8a1c767294afd704da0554c4
parentdc4fe591524016224371869d3858f413554217b5
efi/libstub: Fix allocation size calculations

Adjust the size used in calculations to match the actual size of allocation
that will be performed based on EFI size/alignment constraints.
efi_high_alloc() and efi_low_alloc() use the passed size in bytes directly
to find space in the memory map for the allocation, rather than the actual
allocation size that has been adjusted for size and alignment constraints.
This results in failed allocations and retries in efi_high_alloc().  The
same error is present in efi_low_alloc(), although failure will only happen
if the lowest memory block is small.
Also use EFI_PAGE_SIZE consistently and remove use of EFI_PAGE_SHIFT to
calculate page size.

Signed-off-by: Roy Franz <roy.franz@hpe.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20161112213237.8804-2-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
drivers/firmware/efi/libstub/efi-stub-helper.c