lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240813060036.754213-1-david.hunter.linux@gmail.com>
Date: Tue, 13 Aug 2024 01:59:57 -0400
From: David Hunter <david.hunter.linux@...il.com>
To: davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com,
	shuah@...nel.org,
	kuniyu@...zon.com,
	netdev@...r.kernel.org,
	linux-kselftest@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: javier.carrasco.cruz@...il.com,
	David Hunter <david.hunter.linux@...il.com>
Subject: [PATCH] Kselftest: msg_oob.c: Fix warning for Incorrect Specifier

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@...il.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ