linux-stable/drivers/firmware
Ard Biesheuvel d1cbbc39d6 efi/arm/libstub: Pack FDT after populating it
commit 72a58a63a1 upstream.

Commit:

  24d7c494ce ("efi/arm-stub: Round up FDT allocation to mapping size")

increased the allocation size for the FDT image created by the stub to a
fixed value of 2 MB, to simplify the former code that made several
attempts with increasing values for the size. This is reasonable
given that the allocation is of type EFI_LOADER_DATA, which is released
to the kernel unless it is explicitly memblock_reserve()d by the early
boot code.

However, this allocation size leaked into the 'size' field of the FDT
header metadata, and so the entire allocation remains occupied by the
device tree binary, even if most of it is not used to store device tree
information.

So call fdt_pack() to shrink the FDT data structure to its minimum size
after populating all the fields, so that the remaining memory is no
longer wasted.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: <stable@vger.kernel.org> # v4.12+
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
Fixes: 24d7c494ce ("efi/arm-stub: Round up FDT allocation to mapping size")
Link: http://lkml.kernel.org/r/20181114175544.12860-4-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-21 09:19:25 +01:00
..
arm_scmi firmware: arm_scmi: fix divide by zero when sustained_perf_level is zero 2018-09-06 09:59:40 -07:00
broadcom firmware: bcm47xx_nvram: Support small (0x6000 B) NVRAM partitions 2018-04-23 16:39:35 +01:00
efi efi/arm/libstub: Pack FDT after populating it 2018-11-21 09:19:25 +01:00
google firmware: coreboot: Unmap ioregion after device population 2018-11-13 11:08:37 -08:00
meson firmware: meson-sm: rework meson_sm_init to use module_platform_driver_probe 2018-03-07 17:33:52 -08:00
tegra firmware: tegra: adjust tested variable 2018-03-08 14:43:13 +01:00
arm_scpi.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
arm_sdei.c firmware: arm_sdei: Fix return value check in sdei_present_dt() 2018-01-15 18:16:59 +00:00
dcdbas.c platform/x86: Fix dell driver init order 2018-03-14 11:05:53 -07:00
dcdbas.h
dell_rbu.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
dmi-id.c firmware: dmi: Add access to the SKU ID string 2018-06-17 14:09:42 +02:00
dmi-sysfs.c firmware: dmi: handle missing DMI data gracefully 2018-02-03 11:25:20 +01:00
dmi_scan.c firmware: dmi: Add access to the SKU ID string 2018-06-17 14:09:42 +02:00
edd.c edd: don't spam log if no EDD information is present 2018-03-27 09:51:23 +02:00
iscsi_ibft.c ibft: Deprecate pci_get_bus_and_slot() 2018-01-11 17:26:55 -06:00
iscsi_ibft_find.c
Kconfig firmware: arm_scmi: add device power domain support using genpd 2018-02-28 16:37:57 +00:00
Makefile firmware: arm_scmi: add basic driver infrastructure for SCMI 2018-02-28 16:37:57 +00:00
memmap.c
pcdp.c x86, mpparse, x86/acpi, x86/PCI, x86/dmi, SFI: Use memremap() for RAM mappings 2017-07-18 11:37:58 +02:00
pcdp.h
psci.c firmware/psci: Expose SMCCC version through psci_ops 2018-02-06 22:54:11 +00:00
psci_checker.c drivers/firmware: psci_checker: stash and use topology_core_cpumask for hotplug tests 2018-07-26 00:16:58 -07:00
qcom_scm-32.c firmware: qcom: scm: Fix crash in qcom_scm_call_atomic1() 2018-05-24 22:36:45 -05:00
qcom_scm-64.c remoteproc updates for v4.15 2017-11-17 20:14:10 -08:00
qcom_scm.c firmware: qcom: scm: Add ipq4019 soc compatible 2018-04-25 00:10:33 -05:00
qcom_scm.h remoteproc updates for v4.15 2017-11-17 20:14:10 -08:00
qemu_fw_cfg.c media: headers: fix linux/mod_devicetable.h inclusions 2018-08-02 18:30:54 -04:00
raspberrypi.c firmware: raspberrypi: Remove VLA usage 2018-07-09 10:47:29 -07:00
scpi_pm_domain.c firmware: scpi: add device power domain support using genpd 2016-06-21 10:26:51 +01:00
ti_sci.c - Error path bug fix for overflow tests (Dan) 2018-06-12 18:28:00 -07:00
ti_sci.h firmware: ti_sci: Switch to SPDX Licensing 2018-05-04 23:10:23 -07:00