Re: 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'

From: Andy Shevchenko

Date: Sat Dec 06 2025 - 11:15:56 EST


On Sat, Dec 06, 2025 at 02:44:24PM +0800, kernel test robot wrote:
> 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@xxxxxxxxx/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@xxxxxxxxx/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@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202512061425.x0qTt9ww-lkp@xxxxxxxxx/
>
> All warnings (new ones prefixed by >>):

Not an expert in BPF, but the compiler recommendation to add __printf(1, 0)
sounds reasonable to me. Anybody to confirm that and/or send a patch?

--
With Best Regards,
Andy Shevchenko