[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202005271029.2Aco3MY6%lkp@intel.com>
Date: Wed, 27 May 2020 10:04:32 +0800
From: kbuild test robot <lkp@...el.com>
To: Tony Luck <tony.luck@...el.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Borislav Petkov <bp@...e.de>
Subject: arch/x86/kernel/cpu/mce/dev-mcelog.c:346:2: warning: 'strncpy'
output truncated before terminating nul copying 12 bytes from a string of
the same length
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 444fc5cde64330661bf59944c43844e7d4c2ccd8
commit: d8ecca4043f2d9d89daab7915eca8c2ec6254d0f x86/mce/dev-mcelog: Dynamically allocate space for machine check records
date: 3 months ago
config: x86_64-lkp (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce (this is a W=1 build):
git checkout d8ecca4043f2d9d89daab7915eca8c2ec6254d0f
# save the attached .config to linux build tree
make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@...el.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
arch/x86/kernel/cpu/mce/dev-mcelog.c: In function 'dev_mcelog_init_device':
>> arch/x86/kernel/cpu/mce/dev-mcelog.c:346:2: warning: 'strncpy' output truncated before terminating nul copying 12 bytes from a string of the same length [-Wstringop-truncation]
346 | strncpy(mcelog->signature, MCE_LOG_SIGNATURE, sizeof(mcelog->signature));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/strncpy +346 arch/x86/kernel/cpu/mce/dev-mcelog.c
335
336 static __init int dev_mcelog_init_device(void)
337 {
338 int mce_log_len;
339 int err;
340
341 mce_log_len = max(MCE_LOG_MIN_LEN, num_online_cpus());
342 mcelog = kzalloc(sizeof(*mcelog) + mce_log_len * sizeof(struct mce), GFP_KERNEL);
343 if (!mcelog)
344 return -ENOMEM;
345
> 346 strncpy(mcelog->signature, MCE_LOG_SIGNATURE, sizeof(mcelog->signature));
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (28154 bytes)
Powered by blists - more mailing lists