[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240812184540.60174-1-kuniyu@amazon.com>
Date: Mon, 12 Aug 2024 11:45:40 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <mtodorovac69@...il.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<kuniyu@...zon.com>, <linux-kernel@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>, <netdev@...r.kernel.org>,
<pabeni@...hat.com>, <shuah@...nel.org>, <jain.abhinav177@...il.com>
Subject: Re: [PATCH v1 1/1] selftests: net: af_unix: cast void* to char* in call to macro TH_LOG()
From: Mirsad Todorovac <mtodorovac69@...il.com>
Date: Mon, 12 Aug 2024 02:22:58 +0200
> GCC 13.2.0 reported warning about (void *) beeing used as a param where (char *) is expected:
>
> 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);
> | ^~~~~~
> ../../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:259:25: note: in expansion of macro ‘TH_LOG’
> 259 | TH_LOG("Expected:%s", expected_errno ? strerror(expected_errno) : expected_buf);
> | ^~~~~~
>
> Casting param to (char *) silences the warning.
>
> Fixes: d098d77232c37 ("selftest: af_unix: Add msg_oob.c.")
> Cc: "David S. Miller" <davem@...emloft.net>
> Cc: Eric Dumazet <edumazet@...gle.com>
> Cc: Jakub Kicinski <kuba@...nel.org>
> Cc: Paolo Abeni <pabeni@...hat.com>
> Cc: Shuah Khan <shuah@...nel.org>
> Cc: Kuniyuki Iwashima <kuniyu@...zon.com>
> Cc: netdev@...r.kernel.org
> Cc: linux-kselftest@...r.kernel.org
> Signed-off-by: Mirsad Todorovac <mtodorovac69@...il.com>
Thanks for the patch!
but I found the same patch posted a bit earlier here,
and Abhinav will post v2.
https://lore.kernel.org/netdev/20240810134037.669765-1-jain.abhinav177@gmail.com/
Powered by blists - more mailing lists