[bvanassche:scsi-sdev-printk 1/2] drivers/scsi/scsi_logging_test.c:36:11: warning: diagnostic behavior may be improved by adding the 'format(printf, 3, 0)' attribute to the declaration of 'test_capture_dev_printk'

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/bvanassche/linux scsi-sdev-printk
head:   a31bd03242fd8e9fc6f3b0b5f48ca64bbb6c8f4c
commit: 3046a51bbd1826503f7037dd728fa56f87b73c23 [1/2] scsi: core: Add KUnit tests for scsi_logging.c
config: arm-randconfig-r072-20260818 (https://download.01.org/0day-ci/archive/20260818/[email protected]/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 844a18e753e822736c9805ab779144b647a2c186)
smatch: v0.5.0-9187-g5189e3fb
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260818/[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
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   In file included from drivers/scsi/scsi_logging.c:467:
>> drivers/scsi/scsi_logging_test.c:36:11: warning: diagnostic behavior may be improved by adding the 'format(printf, 3, 0)' attribute to the declaration of 'test_capture_dev_printk' [-Wmissing-format-attribute]
      28 | static void test_capture_dev_printk(const char *level, const struct device *dev,
         | __attribute__((format(printf, 3, 0))) 
      29 |                                     const char *fmt, va_list args)
      30 | {
      31 |         if (captured_count < MAX_CAPTURED_LINES) {
      32 |                 captured_logs[captured_count].level = level;
      33 |                 captured_logs[captured_count].dev = dev;
      34 |                 vscnprintf(captured_logs[captured_count].msg,
      35 |                            sizeof(captured_logs[captured_count].msg), fmt,
      36 |                            args);
         |                                ^
   drivers/scsi/scsi_logging_test.c:28:13: note: 'test_capture_dev_printk' declared here
      28 | static void test_capture_dev_printk(const char *level, const struct device *dev,
         |             ^
   1 warning generated.


vim +36 drivers/scsi/scsi_logging_test.c

    27	
    28	static void test_capture_dev_printk(const char *level, const struct device *dev,
    29					    const char *fmt, va_list args)
    30	{
    31		if (captured_count < MAX_CAPTURED_LINES) {
    32			captured_logs[captured_count].level = level;
    33			captured_logs[captured_count].dev = dev;
    34			vscnprintf(captured_logs[captured_count].msg,
    35				   sizeof(captured_logs[captured_count].msg), fmt,
  > 36				   args);
    37			captured_count++;
    38		}
    39	}
    40	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.