mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-25 06:46:00 +00:00
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>
This commit is contained in:
parent
6a8c2f9781
commit
2984d21a28
1 changed files with 5 additions and 1 deletions
|
@ -21,6 +21,7 @@
|
||||||
#include <mmc.h>
|
#include <mmc.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <pxe_utils.h>
|
#include <pxe_utils.h>
|
||||||
|
#include <linux/sizes.h>
|
||||||
|
|
||||||
#define EFI_DIRNAME "efi/boot/"
|
#define EFI_DIRNAME "efi/boot/"
|
||||||
|
|
||||||
|
@ -281,10 +282,13 @@ static int distro_efi_try_bootflow_files(struct udevice *dev,
|
||||||
ret = distro_efi_get_fdt_name(fname, sizeof(fname), seq);
|
ret = distro_efi_get_fdt_name(fname, sizeof(fname), seq);
|
||||||
if (ret == -EALREADY)
|
if (ret == -EALREADY)
|
||||||
bflow->flags = BOOTFLOWF_USE_PRIOR_FDT;
|
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,
|
ret = bootmeth_common_read_file(dev, bflow, fname,
|
||||||
fdt_addr, &size);
|
fdt_addr, &size);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (*fname) {
|
if (*fname) {
|
||||||
bflow->fdt_fname = strdup(fname);
|
bflow->fdt_fname = strdup(fname);
|
||||||
|
|
Loading…
Add table
Reference in a new issue