[Crosstoolchain-logs] [device-tree-compiler] 206/357: dtc: Fix uninitialized use of structure_ok

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:06:14 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 2d72816ccfdcfd8039ab0b8883f9eeac895984bb
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Tue Dec 4 11:49:43 2007 +1100

    dtc: Fix uninitialized use of structure_ok
    
    My rework of the tree checking code introduced a potentially nasty bug
    - it uses the structure_ok variable uninitialized.  This patch fixes
    the problem.  It's a fairly ugly bandaid approach, but the ugly will
    disappear once future patches have folded the semantic checks into the
    new framework.
    
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 checks.c | 16 +++++++++++++++-
 dtc.c    | 13 +------------
 dtc.h    |  4 ++--
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/checks.c b/checks.c
index cacb5b4..83f1fae 100644
--- a/checks.c
+++ b/checks.c
@@ -270,8 +270,12 @@ static struct check *check_table[] = {
 	&phandle_references,
 };
 
-void process_checks(int force, struct node *dt)
+int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys);
+
+void process_checks(int force, struct boot_info *bi,
+		    int checkflag, int outversion, int boot_cpuid_phys)
 {
+	struct node *dt = bi->dt;
 	int i;
 	int error = 0;
 
@@ -292,6 +296,16 @@ void process_checks(int force, struct node *dt)
 				"output forced\n");
 		}
 	}
+
+	if (checkflag) {
+		if (error) {
+			fprintf(stderr, "Warning: Skipping semantic checks due to structural errors\n");
+		} else {
+			if (!check_semantics(bi->dt, outversion,
+					     boot_cpuid_phys))
+				fprintf(stderr, "Warning: Input tree has semantic errors\n");
+		}
+	}
 }
 
 /*
diff --git a/dtc.c b/dtc.c
index 566c904..179c303 100644
--- a/dtc.c
+++ b/dtc.c
@@ -122,7 +122,6 @@ int main(int argc, char *argv[])
 	FILE *outf = NULL;
 	int outversion = DEFAULT_FDT_VERSION;
 	int boot_cpuid_phys = 0xfeedbeef;
-	int structure_ok;
 
 	quiet      = 0;
 	reservenum = 0;
@@ -205,17 +204,7 @@ int main(int argc, char *argv[])
 	if (! bi || ! bi->dt)
 		die("Couldn't read input tree\n");
 
-	process_checks(force, bi->dt);
-
-	if (check) {
-		if (!structure_ok) {
-			fprintf(stderr, "Warning: Skipping semantic checks due to structural errors\n");
-		} else {
-			if (!check_semantics(bi->dt, outversion,
-					     boot_cpuid_phys))
-				fprintf(stderr, "Warning: Input tree has semantic errors\n");
-		}
-	}
+	process_checks(force, bi, check, outversion, boot_cpuid_phys);
 
 	if (streq(outname, "-")) {
 		outf = stdout;
diff --git a/dtc.h b/dtc.h
index ef91c4c..00a9431 100644
--- a/dtc.h
+++ b/dtc.h
@@ -237,8 +237,8 @@ struct boot_info *build_boot_info(struct reserve_info *reservelist,
 
 /* Checks */
 
-void process_checks(int force, struct node *dt);
-int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys);
+void process_checks(int force, struct boot_info *bi,
+		    int checkflag, int outversion, int boot_cpuid_phys);
 
 /* Flattened trees */
 

-- 
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