summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libpdbg/device.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libpdbg/device.c b/libpdbg/device.c
index dbbe42f..e7b8ee0 100644
--- a/libpdbg/device.c
+++ b/libpdbg/device.c
@@ -786,19 +786,20 @@ int dt_expand_node(struct dt_node *node, const void *fdt, int fdt_node)
uint32_t tag;
if (((err = fdt_check_header(fdt)) != 0)
- || ((err = _fdt_check_node_offset(fdt, fdt_node)) < 0)) {
+ || (fdt_node < 0) || (fdt_node % FDT_TAGSIZE)
+ || (fdt_next_tag(fdt, fdt_node, &fdt_node) != FDT_BEGIN_NODE)) {
prerror("FDT: Error %d parsing node 0x%x\n", err, fdt_node);
return -1;
}
- nextoffset = err;
+ nextoffset = fdt_node;
do {
offset = nextoffset;
tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_PROP:
- prop = _fdt_offset_ptr(fdt, offset);
+ prop = fdt_offset_ptr(fdt, offset, 0);
name = fdt_string(fdt, fdt32_to_cpu(prop->nameoff));
dt_add_property(node, name, prop->data,
fdt32_to_cpu(prop->len));
OpenPOWER on IntegriCloud