Skip to content
Snippets Groups Projects
Commit 2984d21a authored by Simon Glass's avatar Simon Glass Committed by Tom Rini
Browse files

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's avatarSimon Glass <sjg@chromium.org>
parent 6a8c2f97
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment