summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-09-29 23:30:41 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-09-29 23:30:41 +0000
commitf2a2e3fca024742e80e3815d01adefc2750140f1 (patch)
treea56ffe61de902290b9f93461ea76d10ef68c5cd4
parent8023c57ca4fea256e8cde7710d48d91df64f1a1d (diff)
parent14f8b87308455fce6ab72cf86adccb335a28abeb (diff)
downloadlibufdt-android13-qpr1-s5-release.tar.gz
Change-Id: If2d22a596a5b0e0e57024519573f15ecd2646f60
-rw-r--r--ufdt_convert.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ufdt_convert.c b/ufdt_convert.c
index 1e98008..9e7922a 100644
--- a/ufdt_convert.c
+++ b/ufdt_convert.c
@@ -300,9 +300,16 @@ struct ufdt *ufdt_from_fdt(void *fdtp, size_t fdt_size,
return ufdt_construct(NULL, pool);
}
- struct ufdt *res_tree = ufdt_construct(fdtp, pool);
int end_offset;
int start_tag = fdt_next_tag(fdtp, start_offset, &end_offset);
+
+ if (start_tag != FDT_BEGIN_NODE) {
+ return ufdt_construct(NULL, pool);
+ }
+
+ struct ufdt *res_tree = ufdt_construct(fdtp, pool);
+ if (res_tree == NULL) return NULL;
+
res_tree->root =
fdt_to_ufdt_tree(fdtp, start_offset, &end_offset, start_tag, pool);