From db01aa6cb29e3fe05631416fb70f95e195bbc0cc Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Sun, 30 Nov 2025 03:23:58 +0100 Subject: [PATCH] commonlib/device_tree.c: Fix skipping NOP tokens The current code doesn't make much sense. The offset created by the skipping of NOP tokens is just ignored. Reorder the lines to skip the NOP tokens first. Signed-off-by: Maximilian Brune Change-Id: I860a57e4a773b634149e84271b8322d78ac20e32 Reviewed-on: https://review.coreboot.org/c/coreboot/+/90277 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Matt DeVillier Reviewed-by: Julius Werner --- src/commonlib/device_tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commonlib/device_tree.c b/src/commonlib/device_tree.c index 595c3cbb5d..b51f9fc31d 100644 --- a/src/commonlib/device_tree.c +++ b/src/commonlib/device_tree.c @@ -116,11 +116,12 @@ int fdt_next_property(const void *blob, uint32_t offset, struct fdt_property *prop) { struct fdt_header *header = (struct fdt_header *)blob; - uint32_t *ptr = (uint32_t *)(((uint8_t *)blob) + offset); // skip NOP tokens offset += fdt_skip_nops(blob, offset); + uint32_t *ptr = (uint32_t *)(((uint8_t *)blob) + offset); + int index = 0; if (be32toh(ptr[index++]) != FDT_TOKEN_PROPERTY) return 0;