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-prev] [day] [month] [year] [list]
Message-ID: <4c58ab4f-e1c8-4267-a4ba-518986d03125@suse.de>
Date: Mon, 11 Mar 2024 17:20:31 +0300
From: Denis Kirjanov <dkirjanov@...e.de>
To: David Ahern <dsahern@...nel.org>, Denis Kirjanov <kirjanov@...il.com>,
 stephen@...workplumber.org
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH iproute2-next] ss: fix the compiler warning



On 3/9/24 21:22, David Ahern wrote:
> On 3/7/24 3:53 AM, Denis Kirjanov wrote:
>> the patch fixes the following compiler warning:
>>
>> ss.c:1064:53: warning: format string is not a string literal [-Wformat-nonliteral]
>>         len = vsnprintf(pos, buf_chunk_avail(buffer.tail), fmt, _args);
>>                                                            ^~~
>> 1 warning generated.
>>     LINK     ss
>>
>> Fixes: e3ecf0485 ("ss: pretty-print BPF socket-local storage")
>> Signed-off-by: Denis Kirjanov <dkirjanov@...e.de>
>> ---
>>  misc/ss.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/misc/ss.c b/misc/ss.c
>> index 87008d7c..038905f3 100644
>> --- a/misc/ss.c
>> +++ b/misc/ss.c
>> @@ -1042,6 +1042,7 @@ static int buf_update(int len)
>>  }
>>  
>>  /* Append content to buffer as part of the current field */
>> +__attribute__((format(printf, 1, 0)))
>>  static void vout(const char *fmt, va_list args)
>>  {
>>  	struct column *f = current_field;
> 
> The error message does not align with the change - and it does not fix
> the warning.

since vout is not a variadic arguments function I put 0 into the 3rd argument since we 
already have a check in out function.
doc[0] states that:
"For functions where the arguments are not available to be checked (such as vprintf),
specify the third parameter as zero. 
In this case the compiler only checks the format string for consistency." 

[0]: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
> 
> pw-bot: cr
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ