Skip to contentSkip to conversation

drivers/char/ipmi/ipmi_watchdog.c:1251:2: warning: 'strcpy' source argument is the same as destination

DISCUSSION kernel test robot 1 participant 1 message Jun 13, 2025

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   18531f4d1c8c47c4796289dbbc1ab657ffa063d2
commit: de6b4f99010ad22f0242f1fc0f75c0752a56e9bb s390/string: Remove strcpy() implementation
date:   6 weeks ago
config: s390-randconfig-002-20250614 (https://download.01.org/0day-ci/archive/20250614/[email protected]/config)
compiler: s390-linux-gcc (GCC) 10.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250614/[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
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/char/ipmi/ipmi_watchdog.c: In function 'ipmi_wdog_init':

>> drivers/char/ipmi/ipmi_watchdog.c:1251:2: warning: 'strcpy' source argument is the same as destination [-Wrestrict]
    1251 |  strcpy(preop, inval);
         |  ^~~~~~~~~~~~~~~~~~~~
   drivers/char/ipmi/ipmi_watchdog.c:1231:2: warning: 'strcpy' source argument is the same as destination [-Wrestrict]
    1231 |  strcpy(preaction, inval);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/char/ipmi/ipmi_watchdog.c:1207:2: warning: 'strcpy' source argument is the same as destination [-Wrestrict]
    1207 |  strcpy(action, inval);
         |  ^~~~~~~~~~~~~~~~~~~~~

vim +/strcpy +1251 drivers/char/ipmi/ipmi_watchdog.c

^1da177e4c3f41 Linus Torvalds 2005-04-16  1234  
cc4673eecdcc4a Corey Minyard  2005-11-07  1235  static int preop_op(const char *inval, char *outval)
cc4673eecdcc4a Corey Minyard  2005-11-07  1236  {
cc4673eecdcc4a Corey Minyard  2005-11-07  1237  	if (outval)
cc4673eecdcc4a Corey Minyard  2005-11-07  1238  		strcpy(outval, preop);
cc4673eecdcc4a Corey Minyard  2005-11-07  1239  
cc4673eecdcc4a Corey Minyard  2005-11-07  1240  	if (!inval)
cc4673eecdcc4a Corey Minyard  2005-11-07  1241  		return 0;
cc4673eecdcc4a Corey Minyard  2005-11-07  1242  
cc4673eecdcc4a Corey Minyard  2005-11-07  1243  	if (strcmp(inval, "preop_none") == 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16  1244  		preop_val = WDOG_PREOP_NONE;
cc4673eecdcc4a Corey Minyard  2005-11-07  1245  	else if (strcmp(inval, "preop_panic") == 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16  1246  		preop_val = WDOG_PREOP_PANIC;
cc4673eecdcc4a Corey Minyard  2005-11-07  1247  	else if (strcmp(inval, "preop_give_data") == 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16  1248  		preop_val = WDOG_PREOP_GIVE_DATA;
cc4673eecdcc4a Corey Minyard  2005-11-07  1249  	else
cc4673eecdcc4a Corey Minyard  2005-11-07  1250  		return -EINVAL;
cc4673eecdcc4a Corey Minyard  2005-11-07 @1251  	strcpy(preop, inval);
cc4673eecdcc4a Corey Minyard  2005-11-07  1252  	return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16  1253  }

^1da177e4c3f41 Linus Torvalds 2005-04-16 1254

:::::: The code at line 1251 was first introduced by commit
:::::: cc4673eecdcc4a918e4d8796295d798b5e98d602 [PATCH] ipmi: watchdog parms in sysfs

:::::: TO: Corey Minyard <[email protected]>
:::::: CC: Linus Torvalds <[email protected]>

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