diff options
author | Petr Mladek <[email protected]> | 2024-01-11 17:24:19 +0100 |
---|---|---|
committer | Martin K. Petersen <[email protected]> | 2024-01-23 21:14:40 -0500 |
commit | 796cae1a79b192510041563c95d3fc0fab31ec6e (patch) | |
tree | 539815f67c1dd28859b9e7032d01e297853be2c2 /scripts/generate_rust_analyzer.py | |
parent | 332973850054aaf540f9e02a6f037fac449cdeae (diff) |
scsi: core: Safe warning about bad dev info string
Both "model" and "strflags" are passed to "%s" even when one or both are
NULL.
It is safe because vsprintf() would detect the NULL pointer and print
"(null)". But it is a kernel-specific feature and compiler warns about it:
<warning>
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,
| ^~
</warning>
Do not rely on the kernel specific behavior and print the message a safe
way.
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Bart Van Assche <[email protected]>
Acked-by: Chris Down <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions