linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Maninder Singh <maninder1.s@samsung.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Johannes Weiner <hannes@cmpxchg.org>,
	Vaneet Narang <v.narang@samsung.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: [hnaz-mm:master 272/379] lib/vsprintf.c:991:13: warning: variable 'modbuildid' set but not used
Date: Tue, 1 Mar 2022 20:11:04 +0800	[thread overview]
Message-ID: <202203012040.uFWGm3My-lkp@intel.com> (raw)

tree:   https://github.com/hnaz/linux-mm master
head:   a46912c14343fd3269cc133494988af90b377d9f
commit: b314f622e664eb263ea03ef7f4580e37146f123f [272/379] kallsyms: enhance %pS/s/b printing when KALLSYSMS is disabled
config: arm-eseries_pxa_defconfig (https://download.01.org/0day-ci/archive/20220301/202203012040.uFWGm3My-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/hnaz/linux-mm/commit/b314f622e664eb263ea03ef7f4580e37146f123f
        git remote add hnaz-mm https://github.com/hnaz/linux-mm
        git fetch --no-tags hnaz-mm master
        git checkout b314f622e664eb263ea03ef7f4580e37146f123f
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   lib/vsprintf.c: In function 'sprint_module_info':
>> lib/vsprintf.c:991:13: warning: variable 'modbuildid' set but not used [-Wunused-but-set-variable]
     991 |         int modbuildid = 0;
         |             ^~~~~~~~~~
   lib/vsprintf.c: In function 'va_format':
   lib/vsprintf.c:1759:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
    1759 |         buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
         |         ^~~


vim +/modbuildid +991 lib/vsprintf.c

   981	
   982	#if !defined(CONFIG_KALLSYMS) && defined(CONFIG_MODULES)
   983	static int sprint_module_info(char *buf, char *end, unsigned long value,
   984				     const char *fmt)
   985	{
   986		struct module *mod;
   987		unsigned long offset = 1;
   988		unsigned long base;
   989		int ret = 0;
   990		const char *modname;
 > 991		int modbuildid = 0;
   992		int len;
   993	#if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
   994		const unsigned char *buildid = NULL;
   995	#endif
   996	
   997		if (is_ksym_addr(value))
   998			return 0;
   999	
  1000		if (*fmt == 'B' && fmt[1] == 'b')
  1001			modbuildid = 1;
  1002		else if (*fmt == 'S' && (fmt[1] == 'b' || (fmt[1] == 'R' && fmt[2] == 'b')))
  1003			modbuildid = 1;
  1004		else if (*fmt != 's') {
  1005			/*
  1006			 * do nothing.
  1007			 */
  1008		} else
  1009			offset = 0;
  1010	
  1011		preempt_disable();
  1012		mod = __module_address(value);
  1013		if (mod) {
  1014			ret = 1;
  1015			modname = mod->name;
  1016	#if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
  1017			if (modbuildid)
  1018				buildid = mod->build_id;
  1019	#endif
  1020			if (offset) {
  1021				base = (unsigned long)mod->core_layout.base;
  1022				offset = value - base;
  1023			}
  1024		}
  1025	
  1026		preempt_enable();
  1027		if (!ret)
  1028			return 0;
  1029	
  1030		/* address belongs to module */
  1031		if (offset)
  1032			len = sprintf(buf, "0x%lx+0x%lx", base, offset);
  1033		else
  1034			len = sprintf(buf, "0x%lx", value);
  1035	
  1036		len += sprintf(buf + len, " [%s", modname);
  1037	#if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
  1038		if (modbuildid && buildid) {
  1039			/* build ID should match length of sprintf */
  1040			static_assert(sizeof(typeof_member(struct module, build_id)) == 20);
  1041			len += sprintf(buf + len, " %20phN", buildid);
  1042		}
  1043	#endif
  1044		len += sprintf(buf + len, "]");
  1045	
  1046		return len;
  1047	}
  1048	#else
  1049	static inline int sprint_module_info(char *buf, char *end, unsigned long value,
  1050				     const char *fmt)
  1051	{
  1052		return 0;
  1053	}
  1054	#endif
  1055	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


             reply	other threads:[~2022-03-01 12:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01 12:11 kernel test robot [this message]
2022-03-01 18:24 ` Andrew Morton
2022-03-01 19:22   ` Matthew Wilcox
2022-03-02  9:52     ` John Ogness
2022-03-02 11:52       ` Petr Mladek
2022-03-02  9:56     ` Petr Mladek
2022-03-02 12:07   ` 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=202203012040.uFWGm3My-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maninder1.s@samsung.com \
    --cc=v.narang@samsung.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