summaryrefslogtreecommitdiffstats
path: root/cpukit/dtc/libfdt/fdt.c
diff options
context:
space:
mode:
authorNathan Whitehorn <nwhitehorn@freebsd.org>2018-01-25 05:13:40 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-07-19 07:01:11 +0200
commitc13e400a31fceb64bd985ac48ef9c52b7502318b (patch)
treeea164d0991154f922a58b457a27c16b1f28d82a8 /cpukit/dtc/libfdt/fdt.c
parentimplement strnlen for systems that need it (diff)
downloadrtems-c13e400a31fceb64bd985ac48ef9c52b7502318b.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 'cpukit/dtc/libfdt/fdt.c')
-rw-r--r--cpukit/dtc/libfdt/fdt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/cpukit/dtc/libfdt/fdt.c b/cpukit/dtc/libfdt/fdt.c
index fd13236736..7855a17877 100644
--- a/cpukit/dtc/libfdt/fdt.c
+++ b/cpukit/dtc/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: