Re: include/linux/printk.h:434:44: warning: '%s' directive argument is null

From: Petr Mladek
Date: Thu Jan 11 2024 - 11:28:00 EST


On Thu 2024-01-11 20:29:05, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: de927f6c0b07d9e698416c5b287c521b07694cac
> commit: 337015573718b161891a3473d25f59273f2e626b printk: Userspace format indexing support
> date: 2 years, 6 months ago
> config: x86_64-randconfig-002-20240105 (https://download.01.org/0day-ci/archive/20240111/202401112002.AOjwMNM0-lkp@xxxxxxxxx/config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240111/202401112002.AOjwMNM0-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/202401112002.AOjwMNM0-lkp@xxxxxxxxx/
>
> All warnings (new ones prefixed by >>):
>
> In file included from include/linux/kernel.h:19,
> from arch/x86/include/asm/percpu.h:27,
> from arch/x86/include/asm/current.h:6,
> from include/linux/sched.h:12,
> from include/linux/blkdev.h:5,
> from drivers/scsi/scsi_devinfo.c:3:
> drivers/scsi/scsi_devinfo.c: In function 'scsi_dev_info_list_add_str':
> >> include/linux/printk.h:434:44: warning: '%s' directive argument is null [-Wformat-overflow=]
> 434 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
> | ^
> include/linux/printk.h:430:3: note: in definition of macro 'printk_index_wrap'
> 430 | _p_func(_fmt, ##__VA_ARGS__); \
> | ^~~~~~~
> drivers/scsi/scsi_devinfo.c:551:4: note: in expansion of macro 'printk'
> 551 | printk(KERN_ERR "%s: bad dev info string '%s' '%s'"
> | ^~~~~~
> drivers/scsi/scsi_devinfo.c:552:14: note: format string is defined here
> 552 | " '%s'\n", __func__, vendor, model,
> | ^~

This should get fixed by
https://lore.kernel.org/all/20240111162419.12406-1-pmladek@xxxxxxxx/

Best Regards,
Petr