On 11/21/25 5:20 PM, Simon Glass wrote:
Hello Simon,
- create a new VALID_OFFSET assumption (split out from VALID_DTB)
which checks offsets in fdt_next_tag()
The latter might be best. It would likely be very cheap in terms of
code size. In fact, I should have thought of this at the time.
Wouldn't it be better to not misuse libfdt ?
It actually isn't a misuse. It is perfectly OK to pass an invalid
offset and libfdt has defined behaviour in that case, absent any
'assumptions' we force.
It actually isn't OK to pass in invalid offset if we compile FDT with
disabled tree validity checks.
Remember, in Linux these checks are enabled. We added the 'assume'
thing to reduce code size. Here you have found a situation where it
breaks stuff, so we should back off the assumption a bit.
U-Boot also has those checks enabled, SPL does not, and things break
when OF_PLATDATA is enabled and there is no valid node associated with
the udevice.