* [PATCH] libdtc: remove duplicate judgments
@ 2022-09-15 8:55 Jia Xianhua
0 siblings, 0 replies; only message in thread
From: Jia Xianhua @ 2022-09-15 8:55 UTC (permalink / raw)
To: david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, Jia Xianhua
There is no need to check the VALID_DTB repeatedly, and can be combined
into one if statement.
Signed-off-by: Jia Xianhua <jiaxianhua-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
libfdt/fdt.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libfdt/fdt.c b/libfdt/fdt.c
index 9fe7cf4..90a39e8 100644
--- a/libfdt/fdt.c
+++ b/libfdt/fdt.c
@@ -106,7 +106,6 @@ int fdt_check_header(const void *fdt)
}
hdrsize = fdt_header_size(fdt);
if (!can_assume(VALID_DTB)) {
-
if ((fdt_totalsize(fdt) < hdrsize)
|| (fdt_totalsize(fdt) > INT_MAX))
return -FDT_ERR_TRUNCATED;
@@ -115,9 +114,7 @@ int fdt_check_header(const void *fdt)
if (!check_off_(hdrsize, fdt_totalsize(fdt),
fdt_off_mem_rsvmap(fdt)))
return -FDT_ERR_TRUNCATED;
- }
- if (!can_assume(VALID_DTB)) {
/* Bounds check structure block */
if (!can_assume(LATEST) && fdt_version(fdt) < 17) {
if (!check_off_(hdrsize, fdt_totalsize(fdt),
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-09-15 8:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-15 8:55 [PATCH] libdtc: remove duplicate judgments Jia Xianhua
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).