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]
Message-ID: <202301142143.lN8RBKwn-lkp@intel.com>
Date:   Sat, 14 Jan 2023 21:55:45 +0800
From:   kernel test robot <lkp@...el.com>
To:     Tobias Klauser <tklauser@...tanz.ch>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        Palmer Dabbelt <palmerdabbelt@...gle.com>
Subject: drivers/md/dm-cache-metadata.c:1716:9: warning: 'strncpy' specified
 bound 16 equals destination size

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   97ec4d559d939743e8af83628be5af8da610d9dc
commit: 20d38f7c45a44e4b762b586a7bcacbc93ddb3153 riscv: Allow building with kcov coverage
date:   2 years, 6 months ago
config: riscv-randconfig-r042-20230112
compiler: riscv32-linux-gcc (GCC) 12.1.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/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
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/md/

If you fix the issue, kindly add following tag where applicable
| 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:9: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
    1716 |         strncpy(cmd->policy_name, policy_name, sizeof(cmd->policy_name));
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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
https://github.com/intel/lkp-tests

View attachment "config" of type "text/plain" (118286 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ