All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>, bpf <bpf@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-trace-kernel <linux-trace-kernel@vger.kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Matt Bobrowski <mattbobrowski@google.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Alan Maguire <alan.maguire@oracle.com>,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v1 1/1] bpf: Mark BPF printing functions with __printf() attribute
Date: Wed, 10 Dec 2025 15:13:46 +0200	[thread overview]
Message-ID: <aTlyCimsBUsU5QgZ@smile.fi.intel.com> (raw)
In-Reply-To: <CAADnVQLkSoOL8+kELdmX5nzNcXm-s4VbA5+Q-MPcNySsSiu+RQ@mail.gmail.com>

On Wed, Dec 10, 2025 at 04:09:19PM +0900, Alexei Starovoitov wrote:
> On Tue, Dec 9, 2025 at 10:37 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Tue, Dec 09, 2025 at 06:12:46PM +0900, Alexei Starovoitov wrote:
> > > On Tue, Dec 9, 2025 at 1:21 AM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > > >
> > > > The printing functions in BPF code are using printf() type of format,
> > > > and compiler is not happy about them as is:
> > > >
> > > > kernel/bpf/helpers.c:1069:9: error: function ‘____bpf_snprintf’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
> > > >  1069 |         err = bstr_printf(str, str_size, fmt, data.bin_args);
> > > >       |         ^~~
> > > >
> > > > kernel/trace/bpf_trace.c:377:9: error: function ‘____bpf_trace_printk’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
> > > >   377 |         ret = bstr_printf(data.buf, MAX_BPRINTF_BUF, fmt, data.bin_args);
> > > >       |         ^~~
> > > >
> > > > kernel/trace/bpf_trace.c:433:9: error: function ‘____bpf_trace_vprintk’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
> > > >   433 |         ret = bstr_printf(data.buf, MAX_BPRINTF_BUF, fmt, data.bin_args);
> > > >       |         ^~~
> > > >
> > > > kernel/trace/bpf_trace.c:475:9: error: function ‘____bpf_seq_printf’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
> > > >   475 |         seq_bprintf(m, fmt, data.bin_args);
> > > >       |         ^~~~~~~~~~~
> > > >
> > > > Fix the compilation errors by adding __printf() attribute. For that
> > > > we need to pass it down to the BPF_CALL_x() and wrap into PRINTF_BPF_CALL_*()
> > > > to make code neater.
> >
> > > This is pointless churn to shut up a warning.
> >
> > In some cases, like mine, it's an error.
> >
> > > Teach syzbot to stop this spam instead.
> >
> > It prevents to perform `make W=1` builds with the default CONFIG_WERROR,
> > which is 'y'.
> >
> > > At the end this patch doesn't make any visible difference,
> > > since user declarations of these helpers are auto generated
> > > from uapi/bpf.h file and __printf attribute is not there.
> >
> > I see, thanks for the review.
> > Any recommendations on how to fix this properly?
> 
> Add -Wno-suggest-attribute=format
> to corresponding files in Makefile.

Thanks, I just sent a new patch.

> I think it's cleaner than __diag_ignore() in the .c

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2025-12-10 13:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-08 16:18 [PATCH v1 1/1] bpf: Mark BPF printing functions with __printf() attribute Andy Shevchenko
2025-12-09  9:12 ` Alexei Starovoitov
2025-12-09 13:37   ` Andy Shevchenko
2025-12-10  7:09     ` Alexei Starovoitov
2025-12-10 13:13       ` Andy Shevchenko [this message]

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=aTlyCimsBUsU5QgZ@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alan.maguire@oracle.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=martin.lau@linux.dev \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mattbobrowski@google.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.