[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87msdeebyh.fsf@prevas.dk>
Date: Fri, 21 Mar 2025 14:43:18 +0100
From: Rasmus Villemoes <ravi@...vas.dk>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Petr Mladek <pmladek@...e.com>, Christophe JAILLET
<christophe.jaillet@...adoo.fr>, Kees Cook <kees@...nel.org>, Steven
Rostedt <rostedt@...dmis.org>, "Masami Hiramatsu (Google)"
<mhiramat@...nel.org>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
John Ogness <john.ogness@...utronix.de>, Sergey Senozhatsky
<senozhatsky@...omium.org>, Andy Shevchenko <andy@...nel.org>, Mathieu
Desnoyers <mathieu.desnoyers@...icios.com>, Andrew Morton
<akpm@...ux-foundation.org>
Subject: Re: [PATCH v1 5/6] vsnprintf: Mark pointer() with __printf() attribute
On Thu, Mar 20 2025, Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
> pointer() is using printf() type of format, and GCC compiler
> (Debian 14.2.0-17) is not happy about this:
>
> lib/vsprintf.c:2466:17: error: function ‘pointer’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
>
> Fix the compilation errors (`make W=1` when CONFIG_WERROR=y, which is default)
> by adding __printf() attribute.
>
I had quite a bit of trouble reproducing, until I realized I had to
apply your patches in reverse order, because adding the attribute to one
function will then "taint" its callers.
So this one seems to be self-inflicted pain by the annotation of
va_format (which is completely broken, I'll reply separately to that
one). This doesn't solve the false warning for va_format(), but how
about we at least do
static char *va_format(char *buf, char *end, struct va_format *va_fmt,
- struct printf_spec spec, const char *fmt)
+ struct printf_spec spec)
{
case 'V':
- return va_format(buf, end, ptr, spec, fmt);
+ return va_format(buf, end, ptr, spec);
case 'K':
because va_format() doesn't use that fmt argument at all.
Rasmus
Powered by blists - more mailing lists