[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202512061425.x0qTt9ww-lkp@intel.com>
Date: Sat, 6 Dec 2025 14:44:24 +0800
From: kernel test robot <lkp@...el.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org, Petr Mladek <pmladek@...e.com>,
Kees Cook <kees@...nel.org>
Subject: kernel/trace/bpf_trace.c:475:35: warning: diagnostic behavior may be
improved by adding the 'format(printf, 2, 0)' attribute to the declaration
of '____bpf_seq_printf'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f19b84186d297063a1006ca9e1c8597f77a75581
commit: 6b2c1e30ad6846624d935a7ea98dae60458126b8 seq_file: Mark binary printing functions with __printf() attribute
date: 8 months ago
config: riscv-defconfig (https://download.01.org/0day-ci/archive/20251206/202512061425.x0qTt9ww-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 14bf95b06a18b9b59c89601cbc0e5a6f2176b118)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251206/202512061425.x0qTt9ww-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512061425.x0qTt9ww-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> kernel/trace/bpf_trace.c:475:35: warning: diagnostic behavior may be improved by adding the 'format(printf, 2, 0)' attribute to the declaration of '____bpf_seq_printf' [-Wmissing-format-attribute]
458 | seq_bprintf(m, fmt, data.bin_args);
| ^
kernel/trace/bpf_trace.c:458:1: note: '____bpf_seq_printf' declared here
458 | BPF_CALL_5(bpf_seq_printf, struct seq_file *, m, char *, fmt, u32, fmt_size,
| ^
include/linux/filter.h:613:31: note: expanded from macro 'BPF_CALL_5'
613 | #define BPF_CALL_5(name, ...) BPF_CALL_x(5, __NOATTR, name, __VA_ARGS__)
| ^
include/linux/filter.h:597:6: note: expanded from macro 'BPF_CALL_x'
597 | u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \
| ^
<scratch space>:169:1: note: expanded from here
169 | ____bpf_seq_printf
| ^
kernel/trace/bpf_trace.c:3382:10: warning: default initialization of an object of type 'typeof ((attr->link_create.uprobe_multi.path))' (aka 'const unsigned long long') leaves the object uninitialized [-Wdefault-const-init-var-unsafe]
3382 | upath = u64_to_user_ptr(attr->link_create.uprobe_multi.path);
| ^
include/linux/kernel.h:52:2: note: expanded from macro 'u64_to_user_ptr'
52 | typecheck(u64, (x)); \
| ^
include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
11 | typeof(x) __dummy2; \
| ^
kernel/trace/bpf_trace.c:3383:13: warning: default initialization of an object of type 'typeof ((attr->link_create.uprobe_multi.offsets))' (aka 'const unsigned long long') leaves the object uninitialized [-Wdefault-const-init-var-unsafe]
3383 | uoffsets = u64_to_user_ptr(attr->link_create.uprobe_multi.offsets);
| ^
include/linux/kernel.h:52:2: note: expanded from macro 'u64_to_user_ptr'
52 | typecheck(u64, (x)); \
| ^
include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
11 | typeof(x) __dummy2; \
| ^
kernel/trace/bpf_trace.c:3392:21: warning: default initialization of an object of type 'typeof ((attr->link_create.uprobe_multi.ref_ctr_offsets))' (aka 'const unsigned long long') leaves the object uninitialized [-Wdefault-const-init-var-unsafe]
3392 | uref_ctr_offsets = u64_to_user_ptr(attr->link_create.uprobe_multi.ref_ctr_offsets);
| ^
include/linux/kernel.h:52:2: note: expanded from macro 'u64_to_user_ptr'
52 | typecheck(u64, (x)); \
| ^
include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
11 | typeof(x) __dummy2; \
| ^
kernel/trace/bpf_trace.c:3393:13: warning: default initialization of an object of type 'typeof ((attr->link_create.uprobe_multi.cookies))' (aka 'const unsigned long long') leaves the object uninitialized [-Wdefault-const-init-var-unsafe]
3393 | ucookies = u64_to_user_ptr(attr->link_create.uprobe_multi.cookies);
| ^
include/linux/kernel.h:52:2: note: expanded from macro 'u64_to_user_ptr'
52 | typecheck(u64, (x)); \
| ^
include/linux/typecheck.h:11:12: note: expanded from macro 'typecheck'
11 | typeof(x) __dummy2; \
| ^
5 warnings generated.
vim +475 kernel/trace/bpf_trace.c
10aceb629e1984 Dave Marchevsky 2021-09-17 457
492e639f0c2227 Yonghong Song 2020-05-09 458 BPF_CALL_5(bpf_seq_printf, struct seq_file *, m, char *, fmt, u32, fmt_size,
78aa1cc9404399 Jiri Olsa 2022-12-15 459 const void *, args, u32, data_len)
492e639f0c2227 Yonghong Song 2020-05-09 460 {
78aa1cc9404399 Jiri Olsa 2022-12-15 461 struct bpf_bprintf_data data = {
78aa1cc9404399 Jiri Olsa 2022-12-15 462 .get_bin_args = true,
78aa1cc9404399 Jiri Olsa 2022-12-15 463 };
d9c9e4db186ab4 Florent Revest 2021-04-19 464 int err, num_args;
492e639f0c2227 Yonghong Song 2020-05-09 465
335ff4990cf3bf Dave Marchevsky 2021-09-17 466 if (data_len & 7 || data_len > MAX_BPRINTF_VARARGS * 8 ||
78aa1cc9404399 Jiri Olsa 2022-12-15 467 (data_len && !args))
d9c9e4db186ab4 Florent Revest 2021-04-19 468 return -EINVAL;
492e639f0c2227 Yonghong Song 2020-05-09 469 num_args = data_len / 8;
492e639f0c2227 Yonghong Song 2020-05-09 470
78aa1cc9404399 Jiri Olsa 2022-12-15 471 err = bpf_bprintf_prepare(fmt, fmt_size, args, num_args, &data);
492e639f0c2227 Yonghong Song 2020-05-09 472 if (err < 0)
d9c9e4db186ab4 Florent Revest 2021-04-19 473 return err;
492e639f0c2227 Yonghong Song 2020-05-09 474
78aa1cc9404399 Jiri Olsa 2022-12-15 @475 seq_bprintf(m, fmt, data.bin_args);
48cac3f4a96ddf Florent Revest 2021-04-27 476
f19a4050455aad Jiri Olsa 2022-12-15 477 bpf_bprintf_cleanup(&data);
d9c9e4db186ab4 Florent Revest 2021-04-19 478
d9c9e4db186ab4 Florent Revest 2021-04-19 479 return seq_has_overflowed(m) ? -EOVERFLOW : 0;
492e639f0c2227 Yonghong Song 2020-05-09 480 }
492e639f0c2227 Yonghong Song 2020-05-09 481
:::::: The code at line 475 was first introduced by commit
:::::: 78aa1cc9404399a15d2a1205329c6a06236f5378 bpf: Add struct for bin_args arg in bpf_bprintf_prepare
:::::: TO: Jiri Olsa <jolsa@...nel.org>
:::::: CC: Daniel Borkmann <daniel@...earbox.net>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists