linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [zanussi-trace:ftrace/misc-bugfixes-v1 7/7] kernel/trace/trace_events_synth.c:65:9: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length
@ 2022-01-28  3:07 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-01-28  3:07 UTC (permalink / raw)
  To: Tom Zanussi; +Cc: kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git ftrace/misc-bugfixes-v1
head:   a291c672d6e1d7f557d9e15a5ac3f0b446e29dcd
commit: a291c672d6e1d7f557d9e15a5ac3f0b446e29dcd [7/7] tracing: Remove size restriction on synthetic event cmd error logging
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20220128/202201281113.KBRwLvOv-lkp@intel.com/config)
compiler: sparc64-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://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git/commit/?id=a291c672d6e1d7f557d9e15a5ac3f0b446e29dcd
        git remote add zanussi-trace https://git.kernel.org/pub/scm/linux/kernel/git/zanussi/linux-trace.git
        git fetch --no-tags zanussi-trace ftrace/misc-bugfixes-v1
        git checkout a291c672d6e1d7f557d9e15a5ac3f0b446e29dcd
        # 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=sparc SHELL=/bin/bash kernel/trace/

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 >>):

   kernel/trace/trace_events_synth.c: In function 'last_cmd_set':
>> kernel/trace/trace_events_synth.c:65:9: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
      65 |         strncpy(last_cmd, str, strlen(str));
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncpy +65 kernel/trace/trace_events_synth.c

    54	
    55	static void last_cmd_set(const char *str)
    56	{
    57		if (!str)
    58			return;
    59	
    60		kfree(last_cmd);
    61		last_cmd = kzalloc(strlen(str) + 1, GFP_KERNEL);
    62		if (!last_cmd)
    63			return;
    64	
  > 65		strncpy(last_cmd, str, strlen(str));
    66	}
    67	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-28  3:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28  3:07 [zanussi-trace:ftrace/misc-bugfixes-v1 7/7] kernel/trace/trace_events_synth.c:65:9: warning: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).