[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z91vK_6B2T0uA-r6@smile.fi.intel.com>
Date: Fri, 21 Mar 2025 15:52:43 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Rasmus Villemoes <ravi@...vas.dk>
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>,
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 Fri, Mar 21, 2025 at 02:43:18PM +0100, Rasmus Villemoes wrote:
> 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.
Exactly, that's why cover letter has "strict order" mention.
> 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.
Yes, I was thinking about this. I'll do it in a separate patch in v2.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists