efi/libstub: Retrieve FDT size when loaded from UEFI config table
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 4 Mar 2015 12:02:29 +0000 (13:02 +0100)
committerMatt Fleming <matt.fleming@intel.com>
Wed, 1 Apr 2015 11:46:23 +0000 (12:46 +0100)
commita643375f4b175569bc3c03c7a3e758f845c1ccd9
tree89b4845b7d2ff481efcf23dfbf0f5e6b328e1701
parent744937b0b12a669f298949c4a810794c59fead98
efi/libstub: Retrieve FDT size when loaded from UEFI config table

When allocating memory for the copy of the FDT that the stub
modifies and passes to the kernel, it uses the current size as
an estimate of how much memory to allocate, and increases it page
by page if it turns out to be too small. However, when loading
the FDT from a UEFI configuration table, the estimated size is
left at its default value of zero, and the allocation loop runs
starting from zero all the way up to the allocation size that
finally fits the updated FDT.

Instead, retrieve the size of the FDT from the FDT header when
loading it from the UEFI config table.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Roy Franz <roy.franz@linaro.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
drivers/firmware/efi/libstub/arm-stub.c
drivers/firmware/efi/libstub/efistub.h
drivers/firmware/efi/libstub/fdt.c