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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <391af1fe-53ff-4678-a78c-74262724c2e9@gmail.com>
Date: Tue, 13 Aug 2024 17:36:41 +0200
From: Mirsad Todorovac <mtodorovac69@...il.com>
To: Simon Horman <horms@...nel.org>
Cc: Paolo Abeni <pabeni@...hat.com>, Kuniyuki Iwashima <kuniyu@...zon.com>,
 netdev@...r.kernel.org, linux-kselftest@...r.kernel.org,
 linux-kernel@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
 Shuah Khan <shuah@...nel.org>
Subject: Re: [PATCH v1 1/1] selftests: net: af_unix: cast void* to char* in
 call to macro TH_LOG()

Hi, Simon,

On 8/12/24 17:17, Simon Horman wrote:
> On Mon, Aug 12, 2024 at 02:22:58AM +0200, Mirsad Todorovac wrote:
>> GCC 13.2.0 reported warning about (void *) beeing used as a param where (char *) is expected:
> 
> nit: being

Ouch! No patch is small enough that one should take its correctness for granted. :-O

>> 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);
>>       |                 ^~~~~~
> 
> Thanks, I see this too.
> 
>> Casting param to (char *) silences the warning.
> 
> It seems that all callers pass a string as the expected_errno argument.
> Perhaps it's type could be updated to char *, if that is what it is.
> I think this would avoid the need to cast.

Agreed and verified. If it is OK with you, I might post a v2.

Best regards,
Mirsad Todorovac

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ