Blame SOURCES/0008-checkpolicy-use-correct-format-specifier-for-unsigne.patch

83845a
From babc3d53518b7f9f01b83b9c997f9233a58af92b Mon Sep 17 00:00:00 2001
83845a
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
83845a
Date: Tue, 6 Jul 2021 19:54:25 +0200
83845a
Subject: [PATCH] checkpolicy: use correct format specifier for unsigned
83845a
MIME-Version: 1.0
83845a
Content-Type: text/plain; charset=UTF-8
83845a
Content-Transfer-Encoding: 8bit
83845a
83845a
    test/dispol.c:288:4: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
83845a
       snprintf(buf, sizeof(buf), "unknown (%d)", i);
83845a
       ^
83845a
    test/dismod.c:830:4: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
83845a
       snprintf(buf, sizeof(buf), "unknown (%d)", i);
83845a
       ^
83845a
83845a
Found by Cppcheck.
83845a
83845a
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
83845a
---
83845a
 checkpolicy/test/dismod.c | 2 +-
83845a
 checkpolicy/test/dispol.c | 2 +-
83845a
 2 files changed, 2 insertions(+), 2 deletions(-)
83845a
83845a
diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c
83845a
index 3408e9b6b767..fadbc8d16695 100644
83845a
--- a/checkpolicy/test/dismod.c
83845a
+++ b/checkpolicy/test/dismod.c
83845a
@@ -827,7 +827,7 @@ static void display_policycaps(policydb_t * p, FILE * fp)
83845a
 	ebitmap_for_each_positive_bit(&p->policycaps, node, i) {
83845a
 		capname = sepol_polcap_getname(i);
83845a
 		if (capname == NULL) {
83845a
-			snprintf(buf, sizeof(buf), "unknown (%d)", i);
83845a
+			snprintf(buf, sizeof(buf), "unknown (%u)", i);
83845a
 			capname = buf;
83845a
 		}
83845a
 		fprintf(fp, "\t%s\n", capname);
83845a
diff --git a/checkpolicy/test/dispol.c b/checkpolicy/test/dispol.c
83845a
index 8785b7252824..37f71842c9e6 100644
83845a
--- a/checkpolicy/test/dispol.c
83845a
+++ b/checkpolicy/test/dispol.c
83845a
@@ -285,7 +285,7 @@ static void display_policycaps(policydb_t * p, FILE * fp)
83845a
 	ebitmap_for_each_positive_bit(&p->policycaps, node, i) {
83845a
 		capname = sepol_polcap_getname(i);
83845a
 		if (capname == NULL) {
83845a
-			snprintf(buf, sizeof(buf), "unknown (%d)", i);
83845a
+			snprintf(buf, sizeof(buf), "unknown (%u)", i);
83845a
 			capname = buf;
83845a
 		}
83845a
 		fprintf(fp, "\t%s\n", capname);
83845a
-- 
83845a
2.32.0
83845a