public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* lib/vsprintf.c:1528:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute
@ 2024-01-11  2:33 kernel test robot
  2024-01-21 13:54 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2024-01-11  2:33 UTC (permalink / raw)
  To: Petr Mladek
  Cc: oe-kbuild-all, linux-kernel, Sergey Senozhatsky, Andy Shevchenko

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   acc657692aed438e9931438f8c923b2b107aebf9
commit: 45c3e93d751ea50861c796da3cbfc848fa6ddf55 vsprintf: Factor out %pV handler as va_format()
date:   4 years, 9 months ago
config: i386-allnoconfig (https://download.01.org/0day-ci/archive/20240111/202401111051.dDNWAfKw-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240111/202401111051.dDNWAfKw-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401111051.dDNWAfKw-lkp@intel.com/

All warnings (new ones prefixed by >>):

   lib/vsprintf.c:625:7: warning: no previous prototype for 'pointer_string' [-Wmissing-prototypes]
     625 | char *pointer_string(char *buf, char *end, const void *ptr,
         |       ^~~~~~~~~~~~~~
   lib/vsprintf.c: In function 'va_format':
>> lib/vsprintf.c:1528:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
    1528 |         buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
         |         ^~~


vim +1528 lib/vsprintf.c

  1522	
  1523	static char *va_format(char *buf, char *end, struct va_format *va_fmt)
  1524	{
  1525		va_list va;
  1526	
  1527		va_copy(va, *va_fmt->va);
> 1528		buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
  1529		va_end(va);
  1530	
  1531		return buf;
  1532	}
  1533	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lib/vsprintf.c:1528:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute
  2024-01-11  2:33 lib/vsprintf.c:1528:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute kernel test robot
@ 2024-01-21 13:54 ` Andy Shevchenko
  2024-02-13 12:05   ` Rasmus Villemoes
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2024-01-21 13:54 UTC (permalink / raw)
  To: kernel test robot
  Cc: Petr Mladek, oe-kbuild-all, linux-kernel, Sergey Senozhatsky

On Thu, Jan 11, 2024 at 10:33:09AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   acc657692aed438e9931438f8c923b2b107aebf9
> commit: 45c3e93d751ea50861c796da3cbfc848fa6ddf55 vsprintf: Factor out %pV handler as va_format()
> date:   4 years, 9 months ago

Blast from the past?!

...

> All warnings (new ones prefixed by >>):
> 
>    lib/vsprintf.c:625:7: warning: no previous prototype for 'pointer_string' [-Wmissing-prototypes]
>      625 | char *pointer_string(char *buf, char *end, const void *ptr,
>          |       ^~~~~~~~~~~~~~

ce9d3eceb7ff ("lib/vsprintf: Make function pointer_string static")

...

>    lib/vsprintf.c: In function 'va_format':
> >> lib/vsprintf.c:1528:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
>     1528 |         buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
>          |         ^~~

This might be still valid, but I have no idea how to properly fix it.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* lib/vsprintf.c:1528:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute
@ 2024-02-07 13:42 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2024-02-07 13:42 UTC (permalink / raw)
  To: Petr Mladek
  Cc: oe-kbuild-all, linux-kernel, Sergey Senozhatsky, Andy Shevchenko

Hi Petr,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6d280f4d760e3bcb4a8df302afebf085b65ec982
commit: 45c3e93d751ea50861c796da3cbfc848fa6ddf55 vsprintf: Factor out %pV handler as va_format()
date:   4 years, 9 months ago
config: i386-allnoconfig (https://download.01.org/0day-ci/archive/20240207/202402072101.yrr6DK1t-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240207/202402072101.yrr6DK1t-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402072101.yrr6DK1t-lkp@intel.com/

All warnings (new ones prefixed by >>):

   lib/vsprintf.c:625:7: warning: no previous prototype for 'pointer_string' [-Wmissing-prototypes]
     625 | char *pointer_string(char *buf, char *end, const void *ptr,
         |       ^~~~~~~~~~~~~~
   lib/vsprintf.c: In function 'va_format':
>> lib/vsprintf.c:1528:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
    1528 |         buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
         |         ^~~


vim +1528 lib/vsprintf.c

  1522	
  1523	static char *va_format(char *buf, char *end, struct va_format *va_fmt)
  1524	{
  1525		va_list va;
  1526	
  1527		va_copy(va, *va_fmt->va);
> 1528		buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
  1529		va_end(va);
  1530	
  1531		return buf;
  1532	}
  1533	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: lib/vsprintf.c:1528:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute
  2024-01-21 13:54 ` Andy Shevchenko
@ 2024-02-13 12:05   ` Rasmus Villemoes
  0 siblings, 0 replies; 4+ messages in thread
From: Rasmus Villemoes @ 2024-02-13 12:05 UTC (permalink / raw)
  To: Andy Shevchenko, kernel test robot
  Cc: Petr Mladek, oe-kbuild-all, linux-kernel, Sergey Senozhatsky

On 21/01/2024 14.54, Andy Shevchenko wrote:
> On Thu, Jan 11, 2024 at 10:33:09AM +0800, kernel test robot wrote:
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head:   acc657692aed438e9931438f8c923b2b107aebf9
>> commit: 45c3e93d751ea50861c796da3cbfc848fa6ddf55 vsprintf: Factor out %pV handler as va_format()
>> date:   4 years, 9 months ago
> 
> Blast from the past?!
> 
> ..
> 
>>    lib/vsprintf.c: In function 'va_format':
>>>> lib/vsprintf.c:1528:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
>>     1528 |         buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
>>          |         ^~~
> 
> This might be still valid, but I have no idea how to properly fix it.
> 

It's a bogus warning, and the fix belongs in the compiler. When
vsnprintf() is called, but neither the format arg nor the va_list arg
are direct arguments to the caller (and the va_list is not built from
actual varargs using va_start()), there's absolutely no way a __printf
attribute could be appropriate.

IDK if we can shut up the test robot by locally disabling the
Wsuggest-attribute with some pragma.

Rasmus


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-13 12:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-11  2:33 lib/vsprintf.c:1528:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute kernel test robot
2024-01-21 13:54 ` Andy Shevchenko
2024-02-13 12:05   ` Rasmus Villemoes
  -- strict thread matches above, loose matches on Subject: below --
2024-02-07 13:42 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox