From: David Hunter <david.hunter.linux@gmail.com>
To: kuniyu@amazon.com
Cc: davem@davemloft.net, david.hunter.linux@gmail.com,
edumazet@google.com, javier.carrasco.cruz@gmail.com,
kuba@kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, netdev@vger.kernel.org,
pabeni@redhat.com, shuah@kernel.org
Subject: [PATCH 1/1 V2] Kselftest: msg_oob.c: Fix Compiler Warning For Incorrect Specifier
Date: Tue, 13 Aug 2024 15:19:32 -0400 [thread overview]
Message-ID: <20240813191932.991638-1-david.hunter.linux@gmail.com> (raw)
In-Reply-To: <20240813061254.36825-1-kuniyu@amazon.com>
Change declaration to 'char *'. A specifier 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);
| ^~~~~~
'''
I ran the tests using the following command:
'''
make kselftest TARGETS=net/af_unix
'''
I used a diff to examine the difference in output among the three
scenarios (1) before making the change, (2) after changing the
specifier, and (3) after changing the declaration. I saw no difference
in outputs among any of the tests; all three tests had the same exact
output.
For "net/af_unix: msg_oob", all 38 tests passed for msg_oob. I received
this result for all 3 scenarios. Should I have gotten a different
result?
Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
---
Apologies for not looking ahead of time. I definitely need to remember
to check ahead of time. I understand that the other person was first; I
just wanted to get some practice sending patches. This is all still new
to me.
V1 --> V2
- Changed the declaration instead of the specifier.
- Put number of patches for this bug fix.
- Put in tests performed.
---
tools/testing/selftests/net/af_unix/msg_oob.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/af_unix/msg_oob.c b/tools/testing/selftests/net/af_unix/msg_oob.c
index 16d0c172eaeb..535eb2c3d7d1 100644
--- a/tools/testing/selftests/net/af_unix/msg_oob.c
+++ b/tools/testing/selftests/net/af_unix/msg_oob.c
@@ -209,7 +209,7 @@ static void __sendpair(struct __test_metadata *_metadata,
static void __recvpair(struct __test_metadata *_metadata,
FIXTURE_DATA(msg_oob) *self,
- const void *expected_buf, int expected_len,
+ const char *expected_buf, int expected_len,
int buf_len, int flags)
{
int i, ret[2], recv_errno[2], expected_errno = 0;
--
2.43.0
next prev parent reply other threads:[~2024-08-13 19:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 5:59 [PATCH] Kselftest: msg_oob.c: Fix warning for Incorrect Specifier David Hunter
2024-08-13 6:12 ` Kuniyuki Iwashima
2024-08-13 19:19 ` David Hunter [this message]
2024-08-13 19:38 ` [PATCH 1/1 V2] Kselftest: msg_oob.c: Fix Compiler Warning For " 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=20240813191932.991638-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox