From: Neutron Soutmun <neo.neutron@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH] ipset: fix print format warning
Date: Mon, 18 Jan 2021 11:58:30 +0700 [thread overview]
Message-ID: <YAUVdnEg6OMPsUet@hydrogen> (raw)
[-- Attachment #1: Type: text/plain, Size: 1051 bytes --]
* Use PRIx64 for portablility over various architectures.
* The format string for the 64bit number printing is incorrect,
the `%` sign is missing.
* The force types casting over the uint32_t and uint64_t are unnecessary
which warned by the compiler on different architecture.
Signed-off-by: Neutron Soutmun <neo.neutron@gmail.com>
---
lib/print.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/print.c b/lib/print.c
index 0d86a98..a7ffd81 100644
--- a/lib/print.c
+++ b/lib/print.c
@@ -431,10 +431,10 @@ ipset_print_hexnumber(char *buf, unsigned int len,
*(const uint16_t *) number);
else if (maxsize == sizeof(uint32_t))
return snprintf(buf, len, "0x%08"PRIx32,
- (long unsigned) *(const uint32_t *) number);
+ *(const uint32_t *) number);
else if (maxsize == sizeof(uint64_t))
- return snprintf(buf, len, "0x016lx",
- (long long unsigned) *(const uint64_t *) number);
+ return snprintf(buf, len, "0x%016"PRIx64,
+ *(const uint64_t *) number);
else
assert(0);
return 0;
--
2.30.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2021-01-18 4:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 4:58 Neutron Soutmun [this message]
2021-01-19 8:01 ` [PATCH] ipset: fix print format warning Jozsef Kadlecsik
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=YAUVdnEg6OMPsUet@hydrogen \
--to=neo.neutron@gmail.com \
--cc=netfilter-devel@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).