From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: David Vernet <void@manifault.com>,
Changwoo Min <changwoo@igalia.com>,
Emil Tsalapatis <emil@etsalapatis.com>,
kernel test robot <lkp@intel.com>,
sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH sched_ext/for-7.2] sched_ext: Add __printf format attributes to scx_vexit() and bstr formatters
Date: Mon, 4 May 2026 23:37:07 +0200 [thread overview]
Message-ID: <afkRgyCoZKJO1DQo@gpd4> (raw)
In-Reply-To: <d49b20910d6d09389af138f45acbfaf0@kernel.org>
Hi Tejun,
On Mon, May 04, 2026 at 11:20:52AM -1000, Tejun Heo wrote:
> scx_vexit() forwards (fmt, args) to vscnprintf(); bstr_format() and
> __bstr_format() forward fmt to bstr_printf(); the BPF kfunc wrappers
> scx_bpf_exit_bstr(), scx_bpf_error_bstr() and scx_bpf_dump_bstr() in
> turn forward fmt to those formatters. None of them have __printf(),
> so clang -Wmissing-format-attribute fires on the forwarded calls and
> C-side callers don't get format-string checking.
>
> Annotate the six functions with __printf(N, 0) matching the fmt
> parameter position in each.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/all/202605041112.Y6OG7v9r-lkp@intel.com/
> Signed-off-by: Tejun Heo <tj@kernel.org>
Ah, thanks for fixing this, looks good!
Reviewed-by: Andrea Righi <arighi@nvidia.com>
-Andrea
> ---
> kernel/sched/ext.c | 5 +++++
> kernel/sched/ext_internal.h | 5 +++--
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 966a846c213c..7ac7d10a41be 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -9338,6 +9338,7 @@ __bpf_kfunc void scx_bpf_reenqueue_local___v2(const struct bpf_prog_aux *aux)
>
> __bpf_kfunc_end_defs();
>
> +__printf(5, 0)
> static s32 __bstr_format(struct scx_sched *sch, u64 *data_buf, char *line_buf,
> size_t line_size, char *fmt, unsigned long long *data,
> u32 data__sz)
> @@ -9375,6 +9376,7 @@ static s32 __bstr_format(struct scx_sched *sch, u64 *data_buf, char *line_buf,
> return ret;
> }
>
> +__printf(3, 0)
> static s32 bstr_format(struct scx_sched *sch, struct scx_bstr_buf *buf,
> char *fmt, unsigned long long *data, u32 data__sz)
> {
> @@ -9395,6 +9397,7 @@ __bpf_kfunc_start_defs();
> * Indicate that the BPF scheduler wants to exit gracefully, and initiate ops
> * disabling.
> */
> +__printf(2, 0)
> __bpf_kfunc void scx_bpf_exit_bstr(s64 exit_code, char *fmt,
> unsigned long long *data, u32 data__sz,
> const struct bpf_prog_aux *aux)
> @@ -9420,6 +9423,7 @@ __bpf_kfunc void scx_bpf_exit_bstr(s64 exit_code, char *fmt,
> * Indicate that the BPF scheduler encountered a fatal error and initiate ops
> * disabling.
> */
> +__printf(1, 0)
> __bpf_kfunc void scx_bpf_error_bstr(char *fmt, unsigned long long *data,
> u32 data__sz, const struct bpf_prog_aux *aux)
> {
> @@ -9447,6 +9451,7 @@ __bpf_kfunc void scx_bpf_error_bstr(char *fmt, unsigned long long *data,
> * The extra dump may be multiple lines. A single line may be split over
> * multiple calls. The last line is automatically terminated.
> */
> +__printf(1, 0)
> __bpf_kfunc void scx_bpf_dump_bstr(char *fmt, unsigned long long *data,
> u32 data__sz, const struct bpf_prog_aux *aux)
> {
> diff --git a/kernel/sched/ext_internal.h b/kernel/sched/ext_internal.h
> index b4f5dd28855e..0ed79bd891c7 100644
> --- a/kernel/sched/ext_internal.h
> +++ b/kernel/sched/ext_internal.h
> @@ -1477,8 +1477,9 @@ int scx_kfunc_context_filter(const struct bpf_prog *prog, u32 kfunc_id);
>
> bool scx_cpu_valid(struct scx_sched *sch, s32 cpu, const char *where);
>
> -bool scx_vexit(struct scx_sched *sch, enum scx_exit_kind kind, s64 exit_code,
> - s32 exit_cpu, const char *fmt, va_list args);
> +__printf(5, 0) bool scx_vexit(struct scx_sched *sch, enum scx_exit_kind kind,
> + s64 exit_code, s32 exit_cpu, const char *fmt,
> + va_list args);
> __printf(5, 6) bool __scx_exit(struct scx_sched *sch, enum scx_exit_kind kind,
> s64 exit_code, s32 exit_cpu, const char *fmt, ...);
>
> --
> 2.47.0
prev parent reply other threads:[~2026-05-04 21:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 21:20 [PATCH sched_ext/for-7.2] sched_ext: Add __printf format attributes to scx_vexit() and bstr formatters Tejun Heo
2026-05-04 21:23 ` Tejun Heo
2026-05-04 21:37 ` Andrea Righi [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=afkRgyCoZKJO1DQo@gpd4 \
--to=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=emil@etsalapatis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=void@manifault.com \
/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