[Crosstoolchain-logs] [device-tree-compiler] 173/357: libfdt: Correctly handle versions > 17

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:06:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.3.x
in repository device-tree-compiler.

commit 4a5df5c026c96f36326d4037a0658d38193e2ca1
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Tue Oct 30 13:22:12 2007 +1100

    libfdt: Correctly handle versions > 17
    
    If future dtb version > 17 are defined, that are still backwards
    compatible with v16, libfdt will of course be able to read and
    understand them.  However, when modifying such a tree, it can't
    guarantee that it won't clobber additional structure from the new
    version which it doesn't know about.  Therefore, before making
    modifications to a tree of version >17, we must change it's version to
    be exactly 17.
    
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 libfdt/fdt_rw.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c
index 23547a5..78231d0 100644
--- a/libfdt/fdt_rw.c
+++ b/libfdt/fdt_rw.c
@@ -61,7 +61,7 @@ static int rw_check_header(void *fdt)
 
 	if ((err = fdt_check_header(fdt)))
 		return err;
-	if (fdt_version(fdt) < 0x11)
+	if (fdt_version(fdt) < 17)
 		return -FDT_ERR_BADVERSION;
 	if (fdt_off_mem_rsvmap(fdt) < ALIGN(sizeof(struct fdt_header), 8))
 		return -FDT_ERR_BADLAYOUT;
@@ -74,6 +74,9 @@ static int rw_check_header(void *fdt)
 	if (fdt_totalsize(fdt) <
 	    (fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt)))
 		return -FDT_ERR_BADLAYOUT;
+	if (fdt_version(fdt) > 17)
+		fdt_set_version(fdt, 17);
+
 	return 0;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list