diff mbox series

[u-boot,v2019.04-aspeed,v1,1/1] Common:fdt: Check for error return value

Message ID 20201202194703.8793-2-hongweiz@ami.com
State Accepted
Commit 9883df1bbb8e907f4122a582006eaf441b924276
Delegated to: Simon Glass
Headers show
Series Common:fdt: Check for error return | expand

Commit Message

Hongwei Zhang Dec. 2, 2020, 7:47 p.m. UTC
Check for negative return value of fdt_noffset from calling
boot_get_fdt_fit().

Signed-off-by: Hongwei Zhang <hongweiz@ami.com>
---
 common/image-fdt.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Simon Glass Dec. 12, 2020, 3:35 p.m. UTC | #1
On Wed, 2 Dec 2020 at 12:48, Hongwei Zhang <hongweiz@ami.com> wrote:
>
> Check for negative return value of fdt_noffset from calling
> boot_get_fdt_fit().
>
> Signed-off-by: Hongwei Zhang <hongweiz@ami.com>
> ---
>  common/image-fdt.c | 3 +++
>  1 file changed, 3 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass Dec. 23, 2020, 3:45 p.m. UTC | #2
On Sat, 12 Dec 2020 at 08:35, Simon Glass <sjg@chromium.org> wrote:
>
> On Wed, 2 Dec 2020 at 12:48, Hongwei Zhang <hongweiz@ami.com> wrote:
> >
> > Check for negative return value of fdt_noffset from calling
> > boot_get_fdt_fit().
> >
> > Signed-off-by: Hongwei Zhang <hongweiz@ami.com>
> > ---
> >  common/image-fdt.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!
diff mbox series

Patch

diff --git a/common/image-fdt.c b/common/image-fdt.c
index 01186aeac7..52ada56fc1 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -402,6 +402,9 @@  int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
 					&fit_uname_config,
 					arch, &load, &len);
 
+				if (fdt_noffset < 0)
+					goto error;
+
 				images->fit_hdr_fdt = map_sysmem(fdt_addr, 0);
 				images->fit_uname_fdt = fit_uname_fdt;
 				images->fit_noffset_fdt = fdt_noffset;