[Crosstoolchain-logs] [device-tree-compiler] 74/357: Bugfix for CHECK_HAVE_WARN_PHANDLE()

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:05:51 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 54382390e40654957e16da7ba48ee86822ffe590
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Wed Jan 31 15:45:26 2007 +1100

    Bugfix for CHECK_HAVE_WARN_PHANDLE()
    
    At present, the tree checking code in dtc will die with an assertion
    failure if given a tree which has the invalid value 0 or -1 in a
    property which should contain a phandle.  This patch fixes the check
    to die more gracefully with an error message indicating the invalid
    phandle value.
    
    Signed-off-by: David Gibson <dwg at au1.ibm.com>
---
 livetree.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/livetree.c b/livetree.c
index 3e06b31..9ace56c 100644
--- a/livetree.c
+++ b/livetree.c
@@ -427,9 +427,14 @@ static int check_structure(struct node *tree)
 		struct node *ref; \
 		CHECK_HAVE_WARN_ONECELL((xnode), (propname)); \
 		if (prop) {\
-			ref = get_node_by_phandle((root), propval_cell(prop)); \
-			if (! ref) \
-				DO_ERR("\"%s\" property in %s refers to non-existant phandle %x\n", (propname), (xnode)->fullpath, propval_cell(prop)); \
+			cell_t phandle = propval_cell(prop); \
+			if ((phandle == 0) || (phandle == -1)) { \
+				DO_ERR("\"%s\" property in %s contains an invalid phandle %x\n", (propname), (xnode)->fullpath, phandle); \
+			} else { \
+				ref = get_node_by_phandle((root), propval_cell(prop)); \
+				if (! ref) \
+					DO_ERR("\"%s\" property in %s refers to non-existant phandle %x\n", (propname), (xnode)->fullpath, propval_cell(prop)); \
+			} \
 		} \
 	} while (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