[android-common:android17-6.18-2026-04 3/3] kernel/bpf/stream.c:384:70: warning: diagnostic behavior may be improved by adding the 'format(printf, 2, 0)' attribute to the declaration of 'bpf_stream_vprintk_impl'
kernel test robot <[email protected]> Thu, 06 Aug 2026 13:46:10 +0800
| Newsgroups | dev.linux.lists.oe-kbuild-all |
|---|---|
| Message-ID | <[email protected]> |
Hi Mykyta, FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant. tree: https://android.googlesource.com/kernel/common android17-6.18-2026-04 head: 0f03843d0cc5d3b140f7c5dca46a946a00a5c92c commit: 137cc92ffe2e71705fce112656a460d924934ebe [3/3] bpf: add _impl suffix for bpf_stream_vprintk() kfunc config: x86_64-randconfig-013-20260806 (https://download.01.org/0day-ci/archive/20260806/[email protected]/config) compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260806/[email protected]/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 | Fixes: 137cc92ffe2e ("bpf: add _impl suffix for bpf_stream_vprintk() kfunc") | Reported-by: kernel test robot <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ All warnings (new ones prefixed by >>): >> kernel/bpf/stream.c:384:70: warning: diagnostic behavior may be improved by adding the 'format(printf, 2, 0)' attribute to the declaration of 'bpf_stream_vprintk_impl' [-Wmissing-format-attribute] 358 | ret = bstr_printf(data.buf, MAX_BPRINTF_BUF, fmt__str, data.bin_args); | ^ kernel/bpf/stream.c:358:17: note: 'bpf_stream_vprintk_impl' declared here 358 | __bpf_kfunc int bpf_stream_vprintk_impl(int stream_id, const char *fmt__str, const void *args, | ^ 1 warning generated. vim +384 kernel/bpf/stream.c 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 353 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 354 /* 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 355 * Avoid using enum bpf_stream_id so that kfunc users don't have to pull in the 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 356 * enum in headers. 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 357 */ 137cc92ffe2e71 Mykyta Yatsenko 2025-11-04 358 __bpf_kfunc int bpf_stream_vprintk_impl(int stream_id, const char *fmt__str, const void *args, 137cc92ffe2e71 Mykyta Yatsenko 2025-11-04 359 u32 len__sz, void *aux__prog) 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 360 { 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 361 struct bpf_bprintf_data data = { 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 362 .get_bin_args = true, 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 363 .get_buf = true, 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 364 }; 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 365 struct bpf_prog_aux *aux = aux__prog; 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 366 u32 fmt_size = strlen(fmt__str) + 1; 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 367 struct bpf_stream *stream; 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 368 u32 data_len = len__sz; 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 369 int ret, num_args; 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 370 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 371 stream = bpf_stream_get(stream_id, aux); 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 372 if (!stream) 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 373 return -ENOENT; 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 374 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 375 if (data_len & 7 || data_len > MAX_BPRINTF_VARARGS * 8 || 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 376 (data_len && !args)) 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 377 return -EINVAL; 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 378 num_args = data_len / 8; 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 379 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 380 ret = bpf_bprintf_prepare(fmt__str, fmt_size, args, num_args, &data); 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 381 if (ret < 0) 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 382 return ret; 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 383 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 @384 ret = bstr_printf(data.buf, MAX_BPRINTF_BUF, fmt__str, data.bin_args); 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 385 /* Exclude NULL byte during push. */ 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 386 ret = bpf_stream_push_str(stream, data.buf, ret); 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 387 bpf_bprintf_cleanup(&data); 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 388 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 389 return ret; 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 390 } 5ab154f1463a11 Kumar Kartikeya Dwivedi 2025-07-03 391 :::::: The code at line 384 was first introduced by commit :::::: 5ab154f1463a111e1dc8fd5d31eaa7a2a71fe2e6 bpf: Introduce BPF standard streams :::::: TO: Kumar Kartikeya Dwivedi <[email protected]> :::::: CC: Alexei Starovoitov <[email protected]> -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki