lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202311030538.uBMcnne0-lkp@intel.com>
Date:   Fri, 3 Nov 2023 05:13:35 +0800
From:   kernel test robot <lkp@...el.com>
To:     Stephen Boyd <swboyd@...omium.org>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Bixuan Cui <cuibixuan@...wei.com>,
        Randy Dunlap <rdunlap@...radead.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: kernel/kallsyms.c:436:17: warning: 'strcpy' source argument is the
 same as destination

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4652b8e4f3ffa48c706ec334f048c217a7d9750d
commit: 9294523e3768030ae8afb84110bcecc66425a647 module: add printk formats to add module build ID to stacktraces
date:   2 years, 4 months ago
config: x86_64-buildonly-randconfig-002-20231102 (https://download.01.org/0day-ci/archive/20231103/202311030538.uBMcnne0-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231103/202311030538.uBMcnne0-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311030538.uBMcnne0-lkp@intel.com/

All warnings (new ones prefixed by >>):

   kernel/kallsyms.c:566:12: warning: no previous prototype for 'arch_get_kallsym' [-Wmissing-prototypes]
     566 | int __weak arch_get_kallsym(unsigned int symnum, unsigned long *value,
         |            ^~~~~~~~~~~~~~~~
   kernel/kallsyms.c: In function '__sprint_symbol.constprop':
>> kernel/kallsyms.c:436:17: warning: 'strcpy' source argument is the same as destination [-Wrestrict]
     436 |                 strcpy(buffer, name);
         |                 ^~~~~~~~~~~~~~~~~~~~


vim +/strcpy +436 kernel/kallsyms.c

a5c43dae7ae38c Alexey Dobriyan 2007-05-08  418  
42e380832a6911 Robert Peterson 2007-04-30  419  /* Look up a kernel symbol and return it in a text buffer. */
0f77a8d378254f Namhyung Kim    2011-03-24  420  static int __sprint_symbol(char *buffer, unsigned long address,
9294523e376803 Stephen Boyd    2021-07-07  421  			   int symbol_offset, int add_offset, int add_buildid)
^1da177e4c3f41 Linus Torvalds  2005-04-16  422  {
^1da177e4c3f41 Linus Torvalds  2005-04-16  423  	char *modname;
9294523e376803 Stephen Boyd    2021-07-07  424  	const unsigned char *buildid;
^1da177e4c3f41 Linus Torvalds  2005-04-16  425  	const char *name;
^1da177e4c3f41 Linus Torvalds  2005-04-16  426  	unsigned long offset, size;
966c8c12dc9e77 Hugh Dickins    2008-11-19  427  	int len;
^1da177e4c3f41 Linus Torvalds  2005-04-16  428  
0f77a8d378254f Namhyung Kim    2011-03-24  429  	address += symbol_offset;
9294523e376803 Stephen Boyd    2021-07-07  430  	name = kallsyms_lookup_buildid(address, &size, &offset, &modname, &buildid,
9294523e376803 Stephen Boyd    2021-07-07  431  				       buffer);
^1da177e4c3f41 Linus Torvalds  2005-04-16  432  	if (!name)
b86280aa48b67c Namhyung Kim    2014-08-08  433  		return sprintf(buffer, "0x%lx", address - symbol_offset);
19769b762607fe Andrew Morton   2007-07-15  434  
966c8c12dc9e77 Hugh Dickins    2008-11-19  435  	if (name != buffer)
966c8c12dc9e77 Hugh Dickins    2008-11-19 @436  		strcpy(buffer, name);
966c8c12dc9e77 Hugh Dickins    2008-11-19  437  	len = strlen(buffer);
0f77a8d378254f Namhyung Kim    2011-03-24  438  	offset -= symbol_offset;
966c8c12dc9e77 Hugh Dickins    2008-11-19  439  
4796dd200db943 Stephen Boyd    2012-05-29  440  	if (add_offset)
4796dd200db943 Stephen Boyd    2012-05-29  441  		len += sprintf(buffer + len, "+%#lx/%#lx", offset, size);
4796dd200db943 Stephen Boyd    2012-05-29  442  
9294523e376803 Stephen Boyd    2021-07-07  443  	if (modname) {
9294523e376803 Stephen Boyd    2021-07-07  444  		len += sprintf(buffer + len, " [%s", modname);
9294523e376803 Stephen Boyd    2021-07-07  445  #if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID)
9294523e376803 Stephen Boyd    2021-07-07  446  		if (add_buildid && buildid) {
9294523e376803 Stephen Boyd    2021-07-07  447  			/* build ID should match length of sprintf */
9294523e376803 Stephen Boyd    2021-07-07  448  #if IS_ENABLED(CONFIG_MODULES)
9294523e376803 Stephen Boyd    2021-07-07  449  			static_assert(sizeof(typeof_member(struct module, build_id)) == 20);
9294523e376803 Stephen Boyd    2021-07-07  450  #endif
9294523e376803 Stephen Boyd    2021-07-07  451  			len += sprintf(buffer + len, " %20phN", buildid);
9294523e376803 Stephen Boyd    2021-07-07  452  		}
9294523e376803 Stephen Boyd    2021-07-07  453  #endif
9294523e376803 Stephen Boyd    2021-07-07  454  		len += sprintf(buffer + len, "]");
9294523e376803 Stephen Boyd    2021-07-07  455  	}
966c8c12dc9e77 Hugh Dickins    2008-11-19  456  
966c8c12dc9e77 Hugh Dickins    2008-11-19  457  	return len;
^1da177e4c3f41 Linus Torvalds  2005-04-16  458  }
0f77a8d378254f Namhyung Kim    2011-03-24  459  

:::::: The code at line 436 was first introduced by commit
:::::: 966c8c12dc9e77f931e2281ba25d2f0244b06949 sprint_symbol(): use less stack

:::::: TO: Hugh Dickins <hugh@...itas.com>
:::::: CC: Linus Torvalds <torvalds@...ux-foundation.org>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ