[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z-GzXglM4MGgzcgV@smile.fi.intel.com>
Date: Mon, 24 Mar 2025 21:32:46 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Kees Cook <kees@...nel.org>,
"Masami Hiramatsu (Google)" <mhiramat@...nel.org>,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org,
linux-trace-kernel@...r.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Petr Mladek <pmladek@...e.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@...omium.org>
Subject: Re: [PATCH v2 4/6] vsnprintf: Mark binary printing functions with
__printf() attribute
On Mon, Mar 24, 2025 at 03:20:12PM -0400, Steven Rostedt wrote:
> On Fri, 21 Mar 2025 16:40:50 +0200
> Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
>
> > Binary printf() functions are using printf() type of format, and compiler
> > is not happy about them as is:
> >
> > lib/vsprintf.c:3130:47: error: function ‘vbin_printf’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
> > lib/vsprintf.c:3298:33: error: function ‘bstr_printf’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
>
> BTW, I find it disturbing that the compiler is set to "error" on a warning
> that "might be a candidate". What happens if it is not? We have to play
> games to quiet it.
>
> Adding __printf() attributes to stubs seems to be a case of the compiler
> causing more problems than its worth :-/
>
> I honestly hate this error on warning because it causes real pain when
> debugging.
Tell it to Linus :-) since it was him who enabled that default. And since it's
there and defconfigs are also part of the kernel I can't easy remove that, and
TBH I even won't dare doing that.
> There's a lot of times I don't know if the value is long or long
> long, and when I get it wrong, my printk() causes the build to fail. It's
> especially annoying when both long and long long are the same size!
>
> Fixing theses stupid errors takes a non trivial amount of time away from
> actual debugging.
You (actually me) fix them once, currently CI's typically run with W=1, but
with WERROR=n. Which means that the new code that is not fixed a priori, will
induce the CI red report.
> > Fix the compilation errors by adding __printf() attribute.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists