Re: [PATCH] libfdt: Handle failed get_name() on BEGIN_NODE

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



On Thu, Jul 14, 2022 at 09:38:48AM +0100, Pierre-Clément Tosi wrote:
> Validate the return value of fdt_get_name() as an ill-formed DT, causing
> it to fail, could result in fdt_check_full() dereferencing NULL.
> 
> fixes: a2def5479950 ("libfdt: Check that the root-node name is empty")
> Signed-off-by: Pierre-Clément Tosi <ptosi@xxxxxxxxxx>

Applied, thanks.  Sorry it took me so long to look at this.

> ---
>  libfdt/fdt_check.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libfdt/fdt_check.c b/libfdt/fdt_check.c
> index fa410a8..71390ee 100644
> --- a/libfdt/fdt_check.c
> +++ b/libfdt/fdt_check.c
> @@ -66,7 +66,7 @@ int fdt_check_full(const void *fdt, size_t bufsize)
>  				int len;
>  
>  				name = fdt_get_name(fdt, offset, &len);
> -				if (*name || len)
> +				if (!name || *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