[android-common:android15-6.6-2025-07 2/2] kernel/kallsyms.c:503:17: warning: 'strcpy' source argument is the same as destination
kernel test robot <[email protected]>
| Newsgroups | dev.linux.lists.oe-kbuild-all |
|---|---|
| Message-ID | <[email protected]> |
Hi Arnd, FYI, the error/warning still remains. tree: https://android.googlesource.com/kernel/common android15-6.6-2025-07 head: 78af4078ece5032768bb0bc9282e26ca123d7679 commit: 26030cb984dd65e0cb2d0c2489d94941cf8897b4 [2/2] extrawarn: move -Wrestrict into W=1 warnings config: arm64-randconfig-001-20260717 (https://download.01.org/0day-ci/archive/20260718/[email protected]/config) compiler: aarch64-linux-gcc (GCC) 11.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260718/[email protected]/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 | Fixes: 26030cb984dd ("extrawarn: move -Wrestrict into W=1 warnings") | Reported-by: kernel test robot <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ All warnings (new ones prefixed by >>): kernel/kallsyms.c: In function '__sprint_symbol.constprop': >> kernel/kallsyms.c:503:17: warning: 'strcpy' source argument is the same as destination [-Wrestrict] 503 | strcpy(buffer, name); | ^~~~~~~~~~~~~~~~~~~~ vim +/strcpy +503 kernel/kallsyms.c 9d65cb4a1718a0 Alexey Dobriyan 2007-05-08 485 42e380832a6911 Robert Peterson 2007-04-30 486 /* Look up a kernel symbol and return it in a text buffer. */ 0f77a8d378254f Namhyung Kim 2011-03-24 487 static int __sprint_symbol(char *buffer, unsigned long address, 9294523e376803 Stephen Boyd 2021-07-07 488 int symbol_offset, int add_offset, int add_buildid) ^1da177e4c3f41 Linus Torvalds 2005-04-16 489 { ^1da177e4c3f41 Linus Torvalds 2005-04-16 490 char *modname; 9294523e376803 Stephen Boyd 2021-07-07 491 const unsigned char *buildid; ^1da177e4c3f41 Linus Torvalds 2005-04-16 492 const char *name; ^1da177e4c3f41 Linus Torvalds 2005-04-16 493 unsigned long offset, size; 966c8c12dc9e77 Hugh Dickins 2008-11-19 494 int len; ^1da177e4c3f41 Linus Torvalds 2005-04-16 495 0f77a8d378254f Namhyung Kim 2011-03-24 496 address += symbol_offset; 9294523e376803 Stephen Boyd 2021-07-07 497 name = kallsyms_lookup_buildid(address, &size, &offset, &modname, &buildid, 9294523e376803 Stephen Boyd 2021-07-07 498 buffer); ^1da177e4c3f41 Linus Torvalds 2005-04-16 499 if (!name) b86280aa48b67c Namhyung Kim 2014-08-08 500 return sprintf(buffer, "0x%lx", address - symbol_offset); 19769b762607fe Andrew Morton 2007-07-15 501 966c8c12dc9e77 Hugh Dickins 2008-11-19 502 if (name != buffer) 966c8c12dc9e77 Hugh Dickins 2008-11-19 @503 strcpy(buffer, name); 966c8c12dc9e77 Hugh Dickins 2008-11-19 504 len = strlen(buffer); 0f77a8d378254f Namhyung Kim 2011-03-24 505 offset -= symbol_offset; 966c8c12dc9e77 Hugh Dickins 2008-11-19 506 4796dd200db943 Stephen Boyd 2012-05-29 507 if (add_offset) 4796dd200db943 Stephen Boyd 2012-05-29 508 len += sprintf(buffer + len, "+%#lx/%#lx", offset, size); 4796dd200db943 Stephen Boyd 2012-05-29 509 9294523e376803 Stephen Boyd 2021-07-07 510 if (modname) { 9294523e376803 Stephen Boyd 2021-07-07 511 len += sprintf(buffer + len, " [%s", modname); 9294523e376803 Stephen Boyd 2021-07-07 512 #if IS_ENABLED(CONFIG_STACKTRACE_BUILD_ID) 9294523e376803 Stephen Boyd 2021-07-07 513 if (add_buildid && buildid) { 9294523e376803 Stephen Boyd 2021-07-07 514 /* build ID should match length of sprintf */ 9294523e376803 Stephen Boyd 2021-07-07 515 #if IS_ENABLED(CONFIG_MODULES) 9294523e376803 Stephen Boyd 2021-07-07 516 static_assert(sizeof(typeof_member(struct module, build_id)) == 20); 9294523e376803 Stephen Boyd 2021-07-07 517 #endif 9294523e376803 Stephen Boyd 2021-07-07 518 len += sprintf(buffer + len, " %20phN", buildid); 9294523e376803 Stephen Boyd 2021-07-07 519 } 9294523e376803 Stephen Boyd 2021-07-07 520 #endif 9294523e376803 Stephen Boyd 2021-07-07 521 len += sprintf(buffer + len, "]"); 9294523e376803 Stephen Boyd 2021-07-07 522 } 966c8c12dc9e77 Hugh Dickins 2008-11-19 523 966c8c12dc9e77 Hugh Dickins 2008-11-19 524 return len; ^1da177e4c3f41 Linus Torvalds 2005-04-16 525 } 0f77a8d378254f Namhyung Kim 2011-03-24 526 :::::: The code at line 503 was first introduced by commit :::::: 966c8c12dc9e77f931e2281ba25d2f0244b06949 sprint_symbol(): use less stack :::::: TO: Hugh Dickins <[email protected]> :::::: CC: Linus Torvalds <[email protected]> -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki