oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Chris Down <chris@chrisdown.name>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Petr Mladek <pmladek@suse.com>
Subject: include/linux/printk.h:434:44: warning: '%s' directive argument is null
Date: Thu, 11 Jan 2024 20:29:05 +0800	[thread overview]
Message-ID: <202401112002.AOjwMNM0-lkp@intel.com> (raw)

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@intel.com/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@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401112002.AOjwMNM0-lkp@intel.com/

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,
         |              ^~


vim +434 include/linux/printk.h

   406	
   407	/*
   408	 * Some subsystems have their own custom printk that applies a va_format to a
   409	 * generic format, for example, to include a device number or other metadata
   410	 * alongside the format supplied by the caller.
   411	 *
   412	 * In order to store these in the way they would be emitted by the printk
   413	 * infrastructure, the subsystem provides us with the start, fixed string, and
   414	 * any subsequent text in the format string.
   415	 *
   416	 * We take a variable argument list as pr_fmt/dev_fmt/etc are sometimes passed
   417	 * as multiple arguments (eg: `"%s: ", "blah"`), and we must only take the
   418	 * first one.
   419	 *
   420	 * subsys_fmt_prefix must be known at compile time, or compilation will fail
   421	 * (since this is a mistake). If fmt or level is not known at compile time, no
   422	 * index entry will be made (since this can legitimately happen).
   423	 */
   424	#define printk_index_subsys_emit(subsys_fmt_prefix, level, fmt, ...) \
   425		__printk_index_emit(fmt, level, subsys_fmt_prefix)
   426	
   427	#define printk_index_wrap(_p_func, _fmt, ...)				\
   428		({								\
   429			__printk_index_emit(_fmt, NULL, NULL);			\
   430			_p_func(_fmt, ##__VA_ARGS__);				\
   431		})
   432	
   433	
 > 434	#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
   435	#define printk_deferred(fmt, ...)					\
   436		printk_index_wrap(_printk_deferred, fmt, ##__VA_ARGS__)
   437	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2024-01-11 12:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11 12:29 kernel test robot [this message]
2024-01-11 16:27 ` include/linux/printk.h:434:44: warning: '%s' directive argument is null Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202401112002.AOjwMNM0-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=chris@chrisdown.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pmladek@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).