fdt: Check for a valid fdt in oftree_ensure()
Check the header before starting to use it, since this could provide very confusing later, when ofnode calls start to fail. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -83,6 +83,11 @@ static oftree oftree_ensure(void *fdt)
|
||||
if (check_tree_count())
|
||||
return oftree_null();
|
||||
|
||||
if (fdt_check_header(fdt)) {
|
||||
log_err("Invalid device tree blob header\n");
|
||||
return oftree_null();
|
||||
}
|
||||
|
||||
/* register the new tree */
|
||||
i = oftree_count++;
|
||||
oftree_list[i] = fdt;
|
||||
|
||||
Reference in New Issue
Block a user