Re: [RFC PATCH 07/15] libfdt: fdt_check_full: Handle FDT_NOP when FDT_END is expected

David Gibson <[email protected]> Wed, 4 Mar 2026 21:08:50 +1100
Newsgroups org.kernel.vger.devicetree-spec,org.kernel.vger.devicetree-compiler,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <aagEsn0RMGVRFRRO@zatzit>
--pAL3Zc8TOJ2/WxD/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Feb 10, 2026 at 06:33:35PM +0100, Herve Codina wrote:
> fdt_check_full() makes the assumption that a FDT_END tag is present
> immediately after the FDT_END_NODE tag related to the root node.
>=20
> This assumption is not correct. Indeed, FDT_NOP tags can be present
> between this FDT_END_NODE tag and the FDT_END tag.
>=20
> Handle those possible FDT_NOP tags.
>=20
> Signed-off-by: Herve Codina <[email protected]>

Merged, thanks.

> ---
>  libfdt/fdt_check.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>=20
> diff --git a/libfdt/fdt_check.c b/libfdt/fdt_check.c
> index a21ebbc..cca0523 100644
> --- a/libfdt/fdt_check.c
> +++ b/libfdt/fdt_check.c
> @@ -43,7 +43,7 @@ int fdt_check_full(const void *fdt, size_t bufsize)
>  			return nextoffset;
> =20
>  		/* If we see two root nodes, something is wrong */
> -		if (expect_end && tag !=3D FDT_END)
> +		if (expect_end && tag !=3D FDT_END && tag !=3D FDT_NOP)
>  			return -FDT_ERR_BADSTRUCTURE;
> =20
>  		switch (tag) {
> --=20
> 2.52.0
>=20
>=20

--=20
David Gibson (he or they)	| 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

--pAL3Zc8TOJ2/WxD/
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmmoBK0ACgkQzQJF27ox
2GdFtQ//U5GPbKxzxDk24NbMmRtkOgDqjXNrMkzCqsBmfhYsj5QrjCf1orhp+amh
pZV0oz+JNKtTohd5CHb9p443WJWpXB1xSFXtAMBCWgI3ncxSwtyeaeBsA1hpx1SL
1oKw9rHWTDkJL8FiuS6F/dBOAT8VH86a/0k4hUlhxjsB3tjWrjo6W4v6Li/eA/vs
XtKY7ZkOE7G/BDe5DxDuugbXwuu5ZbNTdDLxFlcCCVWG0Ll+RL9TwBNkuAHRkZy6
PCe/1h0YooDOFHFdl3bY6W5dBf4sNspkcUYPMQ5DcWy56J0KEdwrlWCeKGYdPnfb
HH/xFeDcwXybcbt5Vt4b+qOG5/lgX1/+XnX8L3M4wpvlhc/NQJ4wpwA2yisA0xjC
dN9+Yew1yrHjCj7sQvcE+WELYGzuoay3tnUowOc9yIKINQEN3iC0H3AhmRI4jEJD
EzGjPQO59C3zwhmvfUA5PgEujppUd8PrliHQKlpRM+/oQ8HbrdTLVX8qb5fJxGdt
AodFrhU8b0FkgHsfAB+BKozAcG3O6U3lcdqqkor6e0ideGnMTeFSTIv7ZMcWtOyu
QNnYprKmus+McRz+f2SObD1DWFszRtt7+c6EmPdMFKSWz7t16MmH66tt/ulC/UQd
z3k7N4SHlw8ZSlynJXVwbKaRZvRC5g6Cmj3g0Czca+fKouTTCoE=
=86bb
-----END PGP SIGNATURE-----

--pAL3Zc8TOJ2/WxD/--