*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);
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);