libfdt: Don't mask fdt_get_name() returned error
PATCH 1/1 libfdt: Don't mask fdt_get_name() returned error
Return the error code from fdt_get_name() (contained in len when the result is NULL) instead of masking it with FDT_ERR_BADSTRUCTURE.
Fixes fda71da26e7f ("libfdt: Handle failed get_name() on BEGIN_NODE")
Reported-by Mike McTernan <[email protected]>
Signed-off-by Pierre-Clément Tosi <[email protected]>
--- libfdt/fdt_check.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
libfdt/fdt_check.c +4 -1
@@ -66,7 +66,10 @@ int fdt_check_full(const void *fdt, size_t bufsize)int len; name =fdt_get_name (fdt, offset, &len); -if (!name || *name || len) +if (!name) +return len; + +if (*name || len)return -FDT_ERR_BADSTRUCTURE ; }break ;
Signature · 1 line
2.37.1.455.g008518b4e5-goog
A message that is not in the archive (sent off-list or not yet received): 20220729130019.804288-1-ptosi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org
David Gibson
AppliedQuoted 6 lines · Pierre-Clément Tosi
Return the error code from
fdt_get_name()(contained in len when the result is NULL) instead of masking it withFDT_ERR_BADSTRUCTURE.Fixes fda71da26e7f ("libfdt: Handle failed get_name() on BEGIN_NODE")Reported-by Mike McTernan <[email protected]>Signed-off-by Pierre-Clément Tosi <[email protected]>
Applied, thanks.
Quoted 20 lines
--- libfdt/fdt_check.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)libfdt/fdt_check.c +4
-1@@ -66,7 +66,10 @@ int fdt_check_full(const void *fdt, size_t bufsize)int len; name =fdt_get_name (fdt, offset, &len); -if (!name || *name || len) +if (!name) +return len; + +if (*name || len)return -FDT_ERR_BADSTRUCTURE ; }break ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson