[linux-next:master 6710/7019] mm/shrinker_debug.c:143:9: warning: function 'shrinker_debugfs_rename' might be a candidate for 'gnu_printf' format attribute

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   6cc11d2a1759275b856e464265823d94aabd5eaf
commit: cb0552df1adc17e54710d5328b78ba18596679e1 [6710/7019] mm: shrinkers: provide shrinkers with names
config: i386-randconfig-a001 (https://download.01.org/0day-ci/archive/20220630/202206301859.UodBCrva-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=cb0552df1adc17e54710d5328b78ba18596679e1
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout cb0552df1adc17e54710d5328b78ba18596679e1
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   mm/shrinker_debug.c: In function 'shrinker_debugfs_rename':
>> mm/shrinker_debug.c:143:9: warning: function 'shrinker_debugfs_rename' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
     143 |         new = kvasprintf_const(GFP_KERNEL, fmt, ap);
         |         ^~~
--
   mm/vmscan.c: In function 'prealloc_shrinker':
>> mm/vmscan.c:642:9: warning: function 'prealloc_shrinker' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
     642 |         shrinker->name = kvasprintf_const(GFP_KERNEL, fmt, ap);
         |         ^~~~~~~~
   mm/vmscan.c: In function 'register_shrinker':
>> mm/vmscan.c:702:9: warning: function 'register_shrinker' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
     702 |         shrinker->name = kvasprintf_const(GFP_KERNEL, fmt, ap);
         |         ^~~~~~~~


vim +143 mm/shrinker_debug.c

   133	
   134	int shrinker_debugfs_rename(struct shrinker *shrinker, const char *fmt, ...)
   135	{
   136		struct dentry *entry;
   137		char buf[128];
   138		const char *new, *old;
   139		va_list ap;
   140		int ret = 0;
   141	
   142		va_start(ap, fmt);
 > 143		new = kvasprintf_const(GFP_KERNEL, fmt, ap);
   144		va_end(ap);
   145	
   146		if (!new)
   147			return -ENOMEM;
   148	
   149		down_write(&shrinker_rwsem);
   150	
   151		old = shrinker->name;
   152		shrinker->name = new;
   153	
   154		if (shrinker->debugfs_entry) {
   155			snprintf(buf, sizeof(buf), "%s-%d", shrinker->name,
   156				 shrinker->debugfs_id);
   157	
   158			entry = debugfs_rename(shrinker_debugfs_root,
   159					       shrinker->debugfs_entry,
   160					       shrinker_debugfs_root, buf);
   161			if (IS_ERR(entry))
   162				ret = PTR_ERR(entry);
   163			else
   164				shrinker->debugfs_entry = entry;
   165		}
   166	
   167		up_write(&shrinker_rwsem);
   168	
   169		kfree_const(old);
   170	
   171		return ret;
   172	}
   173	EXPORT_SYMBOL(shrinker_debugfs_rename);
   174	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux