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]
Date:   Thu, 17 Sep 2020 02:23:25 +0800
From:   kernel test robot <lkp@...el.com>
To:     Tobias Klauser <tklauser@...tanz.ch>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Palmer Dabbelt <palmerdabbelt@...gle.com>
Subject: drivers/md/dm-cache-metadata.c:1716:2: warning: 'strncpy' specified
 bound 16 equals destination size

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fc4f28bb3daf3265d6bc5f73b497306985bb23ab
commit: 20d38f7c45a44e4b762b586a7bcacbc93ddb3153 riscv: Allow building with kcov coverage
date:   7 weeks ago
config: riscv-randconfig-r013-20200916 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.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
        git checkout 20d38f7c45a44e4b762b586a7bcacbc93ddb3153
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   In function 'write_hints',
       inlined from 'dm_cache_write_hints' at drivers/md/dm-cache-metadata.c:1740:6:
>> drivers/md/dm-cache-metadata.c:1716:2: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
    1716 |  strncpy(cmd->policy_name, policy_name, sizeof(cmd->policy_name));
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=20d38f7c45a44e4b762b586a7bcacbc93ddb3153
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 20d38f7c45a44e4b762b586a7bcacbc93ddb3153
vim +/strncpy +1716 drivers/md/dm-cache-metadata.c

4e781b498ee500 Joe Thornber 2016-09-15  1700  
4e781b498ee500 Joe Thornber 2016-09-15  1701  /*
4e781b498ee500 Joe Thornber 2016-09-15  1702   * It's quicker to always delete the hint array, and recreate with
4e781b498ee500 Joe Thornber 2016-09-15  1703   * dm_array_new().
4e781b498ee500 Joe Thornber 2016-09-15  1704   */
4e781b498ee500 Joe Thornber 2016-09-15  1705  static int write_hints(struct dm_cache_metadata *cmd, struct dm_cache_policy *policy)
c6b4fcbad044e6 Joe Thornber 2013-03-01  1706  {
c6b4fcbad044e6 Joe Thornber 2013-03-01  1707  	int r;
c6b4fcbad044e6 Joe Thornber 2013-03-01  1708  	size_t hint_size;
c6b4fcbad044e6 Joe Thornber 2013-03-01  1709  	const char *policy_name = dm_cache_policy_get_name(policy);
4e7f506f642963 Mike Snitzer 2013-03-20  1710  	const unsigned *policy_version = dm_cache_policy_get_version(policy);
c6b4fcbad044e6 Joe Thornber 2013-03-01  1711  
c6b4fcbad044e6 Joe Thornber 2013-03-01  1712  	if (!policy_name[0] ||
c6b4fcbad044e6 Joe Thornber 2013-03-01  1713  	    (strlen(policy_name) > sizeof(cmd->policy_name) - 1))
c6b4fcbad044e6 Joe Thornber 2013-03-01  1714  		return -EINVAL;
c6b4fcbad044e6 Joe Thornber 2013-03-01  1715  
c6b4fcbad044e6 Joe Thornber 2013-03-01 @1716  	strncpy(cmd->policy_name, policy_name, sizeof(cmd->policy_name));
4e7f506f642963 Mike Snitzer 2013-03-20  1717  	memcpy(cmd->policy_version, policy_version, sizeof(cmd->policy_version));
c6b4fcbad044e6 Joe Thornber 2013-03-01  1718  
c6b4fcbad044e6 Joe Thornber 2013-03-01  1719  	hint_size = dm_cache_policy_get_hint_size(policy);
c6b4fcbad044e6 Joe Thornber 2013-03-01  1720  	if (!hint_size)
c6b4fcbad044e6 Joe Thornber 2013-03-01  1721  		return 0; /* short-circuit hints initialization */
c6b4fcbad044e6 Joe Thornber 2013-03-01  1722  	cmd->policy_hint_size = hint_size;
c6b4fcbad044e6 Joe Thornber 2013-03-01  1723  
c6b4fcbad044e6 Joe Thornber 2013-03-01  1724  	if (cmd->hint_root) {
c6b4fcbad044e6 Joe Thornber 2013-03-01  1725  		r = dm_array_del(&cmd->hint_info, cmd->hint_root);
c6b4fcbad044e6 Joe Thornber 2013-03-01  1726  		if (r)
c6b4fcbad044e6 Joe Thornber 2013-03-01  1727  			return r;
c6b4fcbad044e6 Joe Thornber 2013-03-01  1728  	}
c6b4fcbad044e6 Joe Thornber 2013-03-01  1729  
4e781b498ee500 Joe Thornber 2016-09-15  1730  	return dm_array_new(&cmd->hint_info, &cmd->hint_root,
c6b4fcbad044e6 Joe Thornber 2013-03-01  1731  			    from_cblock(cmd->cache_blocks),
4e781b498ee500 Joe Thornber 2016-09-15  1732  			    get_hint, policy);
0596661f0a16d9 Joe Thornber 2014-04-03  1733  }
0596661f0a16d9 Joe Thornber 2014-04-03  1734  

:::::: The code at line 1716 was first introduced by commit
:::::: c6b4fcbad044e6fffcc75bba160e720eb8d67d17 dm: add cache target

:::::: TO: Joe Thornber <ejt@...hat.com>
:::::: CC: Alasdair G Kergon <agk@...hat.com>

---
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" (31229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ