
12 Nov
2023
12 Nov
'23
4:27 p.m.
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 ---
drivers/core/ofnode.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index c3d326831fc6..3956e1999c36 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -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;
--
2.42.0.869.gea05f2083d-goog