public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Kees Cook <kees@kernel.org>,
	"Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Petr Mladek <pmladek@suse.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH v2 4/6] vsnprintf: Mark binary printing functions with __printf() attribute
Date: Mon, 24 Mar 2025 21:32:46 +0200	[thread overview]
Message-ID: <Z-GzXglM4MGgzcgV@smile.fi.intel.com> (raw)
In-Reply-To: <20250324152012.413380d8@gandalf.local.home>

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@linux.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@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-03-24 19:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 14:40 [PATCH v2 0/6] vsprintf: Add __printf attribute to where it's required Andy Shevchenko
2025-03-21 14:40 ` [PATCH v2 1/6] seq_buf: Mark binary printing functions with __printf() attribute Andy Shevchenko
2025-03-21 14:40 ` [PATCH v2 2/6] seq_file: " Andy Shevchenko
2025-03-21 14:40 ` [PATCH v2 3/6] tracing: " Andy Shevchenko
2025-03-21 14:40 ` [PATCH v2 4/6] vsnprintf: " Andy Shevchenko
2025-03-24 19:20   ` Steven Rostedt
2025-03-24 19:32     ` Andy Shevchenko [this message]
2025-03-21 14:40 ` [PATCH v2 5/6] vsnprintf: Drop unused const char fmt * in va_format() Andy Shevchenko
2025-03-21 14:40 ` [PATCH v2 6/6] vsnprintf: Silence false positive GCC warning for va_format() Andy Shevchenko
2025-03-25 10:15 ` [PATCH v2 0/6] vsprintf: Add __printf attribute to where it's required Petr Mladek
2025-03-28 13:51   ` Petr Mladek
2025-03-28 15:05     ` Andy Shevchenko
2025-03-25 19:38 ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z-GzXglM4MGgzcgV@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox