Re: [PATCH 1/1] kallsyms: enhance %pS/s/b printing when KALLSYSMS is disabled

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

 



Hi Maninder,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on hnaz-mm/master]
[also build test WARNING on next-20220225]
[cannot apply to mcgrof/modules-next linus/master v5.17-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Maninder-Singh/kallsyms-enhance-pS-s-b-printing-when-KALLSYSMS-is-disabled/20220228-140105
base:   https://github.com/hnaz/linux-mm master
config: alpha-randconfig-r032-20220227 (https://download.01.org/0day-ci/archive/20220228/202202281853.EofvQRmv-lkp@xxxxxxxxx/config)
compiler: alpha-linux-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/0day-ci/linux/commit/fbad94837350bb7c5b1b0c33648f8b20eff0150a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Maninder-Singh/kallsyms-enhance-pS-s-b-printing-when-KALLSYSMS-is-disabled/20220228-140105
        git checkout fbad94837350bb7c5b1b0c33648f8b20eff0150a
        # 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=alpha SHELL=/bin/bash

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

All warnings (new ones prefixed by >>):

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


vim +/modbuildid +993 lib/vsprintf.c

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

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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux