From 3759fa111b8c236fd06a35896946458889bc330d Mon Sep 17 00:00:00 2001 From: mintsuki Date: Fri, 12 Jul 2024 19:09:34 +0200 Subject: [PATCH] dtb: Never pass UEFI DTB buffer directly; fix misuse of libfdt API. Closes #384 --- common/lib/misc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/lib/misc.c b/common/lib/misc.c index 754a70c7..ff47a4a2 100644 --- a/common/lib/misc.c +++ b/common/lib/misc.c @@ -124,13 +124,9 @@ void *get_device_tree_blob(size_t extra_size) { printv("efi: found dtb at %p, size %x\n", cur_table->VendorTable, s); - if (extra_size == 0) { - return cur_table->VendorTable; - } - void *new_tab = ext_mem_alloc(s + extra_size); - ret = fdt_resize(cur_table->VendorTable, new_tab, s + extra_size); + ret = fdt_open_into(cur_table->VendorTable, new_tab, s + extra_size); if (ret < 0) { panic(true, "dtb: failed to resize new DTB"); }