mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-17 02:15:02 +00:00
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:
parent
1de1a03487
commit
9578dd856a
1 changed files with 5 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue