[Crosstoolchain-logs] [device-tree-compiler] 33/57: dtc: fix sprintf() format string error, again

Vagrant Cascadian vagrant at moszumanska.debian.org
Thu Sep 28 22:03:58 UTC 2017


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

vagrant pushed a commit to branch upstream/latest
in repository device-tree-compiler.

commit 13ce6e1c2fc4549fbb53a9ca5f577166c6e315ac
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Thu Jun 8 14:35:16 2017 +1000

    dtc: fix sprintf() format string error, again
    
    2a42b14 "dtc: check.c fix compile error" changed a format string using
    %lx which wasn't correct for all platforms.  Unfortunately it changed it to
    %zx, which is wrong for a different set of platforms (and only right on
    the others by accident).  The parameter we're formatting here is uint64_t,
    not size_t, so we need to use the PRIx64 macro from <inttypes.h> to get
    this right.
    
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 checks.c | 2 +-
 dtc.h    | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/checks.c b/checks.c
index 4b72b53..afabf64 100644
--- a/checks.c
+++ b/checks.c
@@ -873,7 +873,7 @@ static void check_simple_bus_reg(struct check *c, struct dt_info *dti, struct no
 	while (size--)
 		reg = (reg << 32) | fdt32_to_cpu(*(cells++));
 
-	snprintf(unit_addr, sizeof(unit_addr), "%zx", reg);
+	snprintf(unit_addr, sizeof(unit_addr), "%"PRIx64, reg);
 	if (!streq(unitname, unit_addr))
 		FAIL(c, dti, "Node %s simple-bus unit address format error, expected \"%s\"",
 		     node->fullpath, unit_addr);
diff --git a/dtc.h b/dtc.h
index fc24e17..409db76 100644
--- a/dtc.h
+++ b/dtc.h
@@ -31,6 +31,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <unistd.h>
+#include <inttypes.h>
 
 #include <libfdt_env.h>
 #include <fdt.h>

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