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

David Gibson
2026-03-05T00:04:09Z

[-- Attachment #1: Type: text/plain, Size: 1238 bytes --]

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.
>
> This assumption is not correct. Indeed, FDT_NOP tags can be present
> between this FDT_END_NODE tag and the FDT_END tag.
>
> Handle those possible FDT_NOP tags.
>
> Signed-off-by: Herve Codina <herve.codina@bootlin.com>

Merged, thanks.

> ---
> 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 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;
>
> /* If we see two root nodes, something is wrong */
> - if (expect_end && tag != FDT_END)
> + if (expect_end && tag != FDT_END && tag != FDT_NOP)
> return -FDT_ERR_BADSTRUCTURE;
>
> switch (tag) {
> --
> 2.52.0
>
>

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]