summaryrefslogtreecommitdiff
path: root/libfdt
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2008-02-14 16:50:34 +1100
committerGerald Van Baren <vanbaren@cideas.com>2008-03-18 21:03:45 -0400
commitf84d65f9b085ffbed464d1d58e8aaa8f5a2efc07 (patch)
tree404dfca7532971a2952d96cc60296f34cd026c30 /libfdt
parentae0b5908de3b9855f8931bc9b32c9fc4962df5a9 (diff)
downloadu-boot-imx-f84d65f9b085ffbed464d1d58e8aaa8f5a2efc07.zip
u-boot-imx-f84d65f9b085ffbed464d1d58e8aaa8f5a2efc07.tar.gz
u-boot-imx-f84d65f9b085ffbed464d1d58e8aaa8f5a2efc07.tar.bz2
libfdt: Fix NOP handling bug in fdt_add_subnode_namelen()
fdt_add_subnode_namelen() has a bug if asked to add a subnode to a node which has NOP tags interspersed with its properties. In this case fdt_add_subnode_namelen() will put the new subnode before the first NOP tag, even if there are properties after it, which will result in an invalid blob. This patch fixes the bug, and adds a testcase for it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'libfdt')
-rw-r--r--libfdt/fdt_rw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c
index a1c70ff..ac50195 100644
--- a/libfdt/fdt_rw.c
+++ b/libfdt/fdt_rw.c
@@ -333,7 +333,7 @@ int fdt_add_subnode_namelen(void *fdt, int parentoffset,
do {
offset = nextoffset;
tag = fdt_next_tag(fdt, offset, &nextoffset);
- } while (tag == FDT_PROP);
+ } while ((tag == FDT_PROP) || (tag == FDT_NOP));
nh = _fdt_offset_ptr_w(fdt, offset);
nodelen = sizeof(*nh) + ALIGN(namelen+1, FDT_TAGSIZE) + FDT_TAGSIZE;