Re: [PATCH] libfdt: Don't mask fdt_get_name() returned error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, Jul 29, 2022 at 02:00:19PM +0100, Pierre-Clément Tosi wrote:
> 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 <mikemcternan@xxxxxxxxxx>
> Signed-off-by: Pierre-Clément Tosi <ptosi@xxxxxxxxxx>

Applied, thanks.

> ---
>  libfdt/fdt_check.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libfdt/fdt_check.c b/libfdt/fdt_check.c
> index 71390ee..a21ebbc 100644
> --- a/libfdt/fdt_check.c
> +++ b/libfdt/fdt_check.c
> @@ -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;

-- 
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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux