summaryrefslogtreecommitdiff
path: root/boot/bootmeth_efi.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-07-27 06:01:24 +0300
committerTom Rini <trini@konsulko.com>2023-08-03 22:30:54 +0300
commit2984d21a28f812c9c1fd2243cc72796f69a61585 (patch)
tree73d60bf0b8a09427b05c4b6df6edc5e81036e3fb /boot/bootmeth_efi.c
parent6a8c2f9781cede2a7cb2b95ee6310cd53b1c20e2 (diff)
downloadu-boot-2984d21a28f812c9c1fd2243cc72796f69a61585.tar.xz
bootstd: Init the size before reading the devicetree
The implementation in distro_efi_try_bootflow_files() does not pass a valid size to bootmeth_common_read_file(), so this can fail if the uninted value happens to be too small. Fix this. This was reported by someone but I cannot now find the email. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/bootmeth_efi.c')
-rw-r--r--boot/bootmeth_efi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/boot/bootmeth_efi.c b/boot/bootmeth_efi.c
index bceec0d12e..1c9f2b1e2f 100644
--- a/boot/bootmeth_efi.c
+++ b/boot/bootmeth_efi.c
@@ -21,6 +21,7 @@
#include <mmc.h>
#include <net.h>
#include <pxe_utils.h>
+#include <linux/sizes.h>
#define EFI_DIRNAME "efi/boot/"
@@ -281,9 +282,12 @@ static int distro_efi_try_bootflow_files(struct udevice *dev,
ret = distro_efi_get_fdt_name(fname, sizeof(fname), seq);
if (ret == -EALREADY)
bflow->flags = BOOTFLOWF_USE_PRIOR_FDT;
- if (!ret)
+ if (!ret) {
+ /* Limit FDT files to 4MB */
+ size = SZ_4M;
ret = bootmeth_common_read_file(dev, bflow, fname,
fdt_addr, &size);
+ }
}
if (*fname) {