X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=lib%2Fof_live.c;h=f35148338715e7063b4d95c543fb1000778870bb;hb=f0959dbee2b043c4b1bf16a570be9242cf603819;hp=51927f9e913a9a3164b86c9394cf176ab851f889;hpb=b07d044d5bfa8c440b172eb3f8a9d537f82e21b6;p=people%2Fms%2Fu-boot.git diff --git a/lib/of_live.c b/lib/of_live.c index 51927f9e91..f351483387 100644 --- a/lib/of_live.c +++ b/lib/of_live.c @@ -216,9 +216,12 @@ static void *unflatten_dt_node(const void *blob, void *mem, int *poffset, *poffset = fdt_next_node(blob, *poffset, &depth); if (depth < 0) depth = 0; - while (*poffset > 0 && depth > old_depth) + while (*poffset > 0 && depth > old_depth) { mem = unflatten_dt_node(blob, mem, poffset, np, NULL, fpsize, dryrun); + if (!mem) + return NULL; + } if (*poffset < 0 && *poffset != -FDT_ERR_NOTFOUND) { debug("unflatten: error %d processing FDT\n", *poffset); @@ -286,6 +289,8 @@ static int unflatten_device_tree(const void *blob, start = 0; size = (unsigned long)unflatten_dt_node(blob, NULL, &start, NULL, NULL, 0, true); + if (!size) + return -EFAULT; size = ALIGN(size, 4); debug(" size is %lx, allocating...\n", size);