From: David Hunter <david.hunter.linux@gmail.com>
To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, shuah@kernel.org, kuniyu@amazon.com,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: javier.carrasco.cruz@gmail.com,
David Hunter <david.hunter.linux@gmail.com>
Subject: [PATCH] Kselftest: msg_oob.c: Fix warning for Incorrect Specifier
Date: Tue, 13 Aug 2024 01:59:57 -0400 [thread overview]
Message-ID: <20240813060036.754213-1-david.hunter.linux@gmail.com> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 2417 bytes --]
Change specifier to %p to correctly substitute type 'const void *'. A
specifer involved with a macro is causing a misleading warning to occur:
In file included from msg_oob.c:14:
msg_oob.c: In function ‘__recvpair’:
../../kselftest_harness.h:106:40: warning: format ‘%s’ expects
argument of type ‘char *’, but argument 6 has type
‘const void *’ [-Wformat=]
106 | fprintf(TH_LOG_STREAM, "# %s:%d:%s:" fmt "\n", \
| ^~~~~~~~~~~~~
../../kselftest_harness.h:101:17: note: in expansion of macro ‘__TH_LOG’
101 | __TH_LOG(fmt, ##__VA_ARGS__); \
| ^~~~~~~~
msg_oob.c:235:17: note: in expansion of macro ‘TH_LOG’
235 | TH_LOG("Expected:%s", expected_errno ?
strerror(expected_errno) : expected_buf);
| ^~~~~~
A second set of these three warnings occur later for the incorrect
specifier at msg_oob.c:256. By tracing the various macros involved, the
correct specifier (in msg_oob.c) can be spotted and changed.
Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
---
tools/testing/selftests/net/af_unix/msg_oob.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/af_unix/msg_oob.c b/tools/testing/selftests/net/af_unix/msg_oob.c
index 16d0c172eaeb..87090ebda2a7 100644
--- a/tools/testing/selftests/net/af_unix/msg_oob.c
+++ b/tools/testing/selftests/net/af_unix/msg_oob.c
@@ -232,7 +232,7 @@ static void __recvpair(struct __test_metadata *_metadata,
if (ret[0] != expected_len || recv_errno[0] != expected_errno) {
TH_LOG("AF_UNIX :%s", ret[0] < 0 ? strerror(recv_errno[0]) : recv_buf[0]);
- TH_LOG("Expected:%s", expected_errno ? strerror(expected_errno) : expected_buf);
+ TH_LOG("Expected:%p", expected_errno ? strerror(expected_errno) : expected_buf);
ASSERT_EQ(ret[0], expected_len);
ASSERT_EQ(recv_errno[0], expected_errno);
@@ -256,7 +256,7 @@ static void __recvpair(struct __test_metadata *_metadata,
cmp = strncmp(expected_buf, recv_buf[0], expected_len);
if (cmp) {
TH_LOG("AF_UNIX :%s", ret[0] < 0 ? strerror(recv_errno[0]) : recv_buf[0]);
- TH_LOG("Expected:%s", expected_errno ? strerror(expected_errno) : expected_buf);
+ TH_LOG("Expected:%p", expected_errno ? strerror(expected_errno) : expected_buf);
ASSERT_EQ(cmp, 0);
}
--
2.43.0
next reply other threads:[~2024-08-13 6:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 5:59 David Hunter [this message]
2024-08-13 6:12 ` [PATCH] Kselftest: msg_oob.c: Fix warning for Incorrect Specifier Kuniyuki Iwashima
2024-08-13 19:19 ` [PATCH 1/1 V2] Kselftest: msg_oob.c: Fix Compiler Warning For " David Hunter
2024-08-13 19:38 ` Kuniyuki Iwashima
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=20240813060036.754213-1-david.hunter.linux@gmail.com \
--to=david.hunter.linux@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.