selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christian Göttsche" <cgzones@googlemail.com>
To: selinux@vger.kernel.org
Subject: [PATCH 05/13] checkpolicy: use correct format specifier for unsigned
Date: Tue,  6 Jul 2021 19:54:25 +0200	[thread overview]
Message-ID: <20210706175433.29270-5-cgzones@googlemail.com> (raw)
In-Reply-To: <20210706175433.29270-1-cgzones@googlemail.com>

    test/dispol.c:288:4: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
       snprintf(buf, sizeof(buf), "unknown (%d)", i);
       ^
    test/dismod.c:830:4: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
       snprintf(buf, sizeof(buf), "unknown (%d)", i);
       ^

Found by Cppcheck.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 checkpolicy/test/dismod.c | 2 +-
 checkpolicy/test/dispol.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c
index 3408e9b6..fadbc8d1 100644
--- a/checkpolicy/test/dismod.c
+++ b/checkpolicy/test/dismod.c
@@ -827,7 +827,7 @@ static void display_policycaps(policydb_t * p, FILE * fp)
 	ebitmap_for_each_positive_bit(&p->policycaps, node, i) {
 		capname = sepol_polcap_getname(i);
 		if (capname == NULL) {
-			snprintf(buf, sizeof(buf), "unknown (%d)", i);
+			snprintf(buf, sizeof(buf), "unknown (%u)", i);
 			capname = buf;
 		}
 		fprintf(fp, "\t%s\n", capname);
diff --git a/checkpolicy/test/dispol.c b/checkpolicy/test/dispol.c
index 8785b725..37f71842 100644
--- a/checkpolicy/test/dispol.c
+++ b/checkpolicy/test/dispol.c
@@ -285,7 +285,7 @@ static void display_policycaps(policydb_t * p, FILE * fp)
 	ebitmap_for_each_positive_bit(&p->policycaps, node, i) {
 		capname = sepol_polcap_getname(i);
 		if (capname == NULL) {
-			snprintf(buf, sizeof(buf), "unknown (%d)", i);
+			snprintf(buf, sizeof(buf), "unknown (%u)", i);
 			capname = buf;
 		}
 		fprintf(fp, "\t%s\n", capname);
-- 
2.32.0


  parent reply	other threads:[~2021-07-06 17:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 17:54 [PATCH 01/13] checkpolicy: pass CFLAGS at link stage Christian Göttsche
2021-07-06 17:54 ` [PATCH 02/13] checkpolicy: drop -pipe compile option Christian Göttsche
2021-07-06 17:54 ` [PATCH 03/13] checkpolicy: simplify assignment Christian Göttsche
2021-07-06 17:54 ` [PATCH 04/13] checkpolicy: drop dead condition Christian Göttsche
2021-07-06 17:54 ` Christian Göttsche [this message]
2021-07-06 17:54 ` [PATCH 06/13] checkpolicy: follow declaration-after-statement Christian Göttsche
2021-07-12  7:13   ` Nicolas Iooss
2021-07-13 19:59     ` Nicolas Iooss
2021-07-06 17:54 ` [PATCH 07/13] checkpolicy: remove dead assignments Christian Göttsche
2021-07-06 17:54 ` [PATCH 08/13] checkpolicy: check before potential NULL dereference Christian Göttsche
2021-07-06 17:54 ` [PATCH 09/13] checkpolicy: avoid potential use of uninitialized variable Christian Göttsche
2021-07-06 17:54 ` [PATCH 10/13] checkpolicy: drop redundant cast to the same type Christian Göttsche
2021-07-06 17:54 ` [PATCH 11/13] checkpolicy: parse_util drop unused declaration Christian Göttsche
2021-07-06 17:54 ` [PATCH 12/13] checkpolicy/test: mark file local functions static Christian Göttsche
2021-07-06 17:54 ` [PATCH 13/13] checkpolicy: mark read-only parameters in policy define const Christian Göttsche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210706175433.29270-5-cgzones@googlemail.com \
    --to=cgzones@googlemail.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).