diff options
author | Nathan Whitehorn <nwhitehorn@freebsd.org> | 2018-01-25 05:13:40 +0000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-01-27 18:43:21 +1100 |
commit | f1879e1a50ebc3786540a075701ccaead2bfbe1f (patch) | |
tree | bfc6f37f2055cb4d253254701f43391c5b563abe /libfdt/fdt.c | |
parent | 37dea76e9700fa4799b4cb1abfd74b121f6e3dd8 (diff) | |
download | dtc-f1879e1a50ebc3786540a075701ccaead2bfbe1f.zip dtc-f1879e1a50ebc3786540a075701ccaead2bfbe1f.tar.gz dtc-f1879e1a50ebc3786540a075701ccaead2bfbe1f.tar.bz2 |
Add limited read-only support for older (V2 and V3) device tree to libfdt.
This can be useful in particular in the kernel when booting on systems
with FDT-emitting firmware that is out of date. Releases of kexec-tools
on ppc64 prior to the end of 2014 are notable examples of such.
Signed-off-by: Nathan Whitehorn <nwhitehorn@freebsd.org>
[dwg: Some whitespace cleanups]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'libfdt/fdt.c')
-rw-r--r-- | libfdt/fdt.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libfdt/fdt.c b/libfdt/fdt.c index fd13236..7855a17 100644 --- a/libfdt/fdt.c +++ b/libfdt/fdt.c @@ -123,6 +123,9 @@ uint32_t fdt_next_tag(const void *fdt, int startoffset, int *nextoffset) /* skip-name offset, length and value */ offset += sizeof(struct fdt_property) - FDT_TAGSIZE + fdt32_to_cpu(*lenp); + if (fdt_version(fdt) < 0x10 && fdt32_to_cpu(*lenp) >= 8 && + ((offset - fdt32_to_cpu(*lenp)) % 8) != 0) + offset += 4; break; case FDT_END: |