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: <202109090516.eB9KGzKy-lkp@intel.com>
Date:   Thu, 9 Sep 2021 05:42:30 +0800
From:   kernel test robot <lkp@...el.com>
To:     Heiko Carstens <hca@...ux.ibm.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: block/partitions/ldm.c:134:9: warning: 'strncpy' specified bound 16
 equals destination size

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2d338201d5311bcd79d42f66df4cecbcbc5f4f2c
commit: 334ef6ed06fa1a54e35296b77b693bcf6d63ee9e init/Kconfig: make COMPILE_TEST depend on !S390
date:   10 months ago
config: s390-buildonly-randconfig-r005-20210909 (attached as .config)
compiler: s390-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/torvalds/linux.git/commit/?id=334ef6ed06fa1a54e35296b77b693bcf6d63ee9e
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 334ef6ed06fa1a54e35296b77b693bcf6d63ee9e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=s390 

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 'ldm_parse_tocblock',
       inlined from 'ldm_validate_tocblocks' at block/partitions/ldm.c:386:7:
>> block/partitions/ldm.c:134:9: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
     134 |         strncpy (toc->bitmap1_name, data + 0x24, sizeof (toc->bitmap1_name));
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   block/partitions/ldm.c:145:9: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
     145 |         strncpy (toc->bitmap2_name, data + 0x46, sizeof (toc->bitmap2_name));
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncpy +134 block/partitions/ldm.c

^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  111  
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  112  /**
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  113   * ldm_parse_tocblock - Read the LDM Database TOCBLOCK structure
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  114   * @data:  Raw database TOCBLOCK structure loaded from the device
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  115   * @toc:   In-memory toc structure in which to return parsed information
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  116   *
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  117   * This parses the LDM Database TOCBLOCK (table of contents) structure supplied
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  118   * in @data and sets up the in-memory tocblock structure @toc with the obtained
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  119   * information.
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  120   *
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  121   * N.B.  The *_start and *_size values returned in @toc are not range-checked.
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  122   *
130c6b98984a05 fs/partitions/ldm.c Richard Knutsson 2006-09-30  123   * Return:  'true'   @toc contains the TOCBLOCK data
130c6b98984a05 fs/partitions/ldm.c Richard Knutsson 2006-09-30  124   *          'false'  @toc contents are undefined
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  125   */
130c6b98984a05 fs/partitions/ldm.c Richard Knutsson 2006-09-30  126  static bool ldm_parse_tocblock (const u8 *data, struct tocblock *toc)
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  127  {
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  128  	BUG_ON (!data || !toc);
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  129  
b7bbf8fa6ba329 fs/partitions/ldm.c Harvey Harrison  2008-07-25  130  	if (MAGIC_TOCBLOCK != get_unaligned_be64(data)) {
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  131  		ldm_crit ("Cannot find TOCBLOCK, database may be corrupt.");
130c6b98984a05 fs/partitions/ldm.c Richard Knutsson 2006-09-30  132  		return false;
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  133  	}
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16 @134  	strncpy (toc->bitmap1_name, data + 0x24, sizeof (toc->bitmap1_name));
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  135  	toc->bitmap1_name[sizeof (toc->bitmap1_name) - 1] = 0;
b7bbf8fa6ba329 fs/partitions/ldm.c Harvey Harrison  2008-07-25  136  	toc->bitmap1_start = get_unaligned_be64(data + 0x2E);
b7bbf8fa6ba329 fs/partitions/ldm.c Harvey Harrison  2008-07-25  137  	toc->bitmap1_size  = get_unaligned_be64(data + 0x36);
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  138  
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  139  	if (strncmp (toc->bitmap1_name, TOC_BITMAP1,
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  140  			sizeof (toc->bitmap1_name)) != 0) {
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  141  		ldm_crit ("TOCBLOCK's first bitmap is '%s', should be '%s'.",
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  142  				TOC_BITMAP1, toc->bitmap1_name);
130c6b98984a05 fs/partitions/ldm.c Richard Knutsson 2006-09-30  143  		return false;
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  144  	}
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  145  	strncpy (toc->bitmap2_name, data + 0x46, sizeof (toc->bitmap2_name));
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  146  	toc->bitmap2_name[sizeof (toc->bitmap2_name) - 1] = 0;
b7bbf8fa6ba329 fs/partitions/ldm.c Harvey Harrison  2008-07-25  147  	toc->bitmap2_start = get_unaligned_be64(data + 0x50);
b7bbf8fa6ba329 fs/partitions/ldm.c Harvey Harrison  2008-07-25  148  	toc->bitmap2_size  = get_unaligned_be64(data + 0x58);
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  149  	if (strncmp (toc->bitmap2_name, TOC_BITMAP2,
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  150  			sizeof (toc->bitmap2_name)) != 0) {
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  151  		ldm_crit ("TOCBLOCK's second bitmap is '%s', should be '%s'.",
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  152  				TOC_BITMAP2, toc->bitmap2_name);
130c6b98984a05 fs/partitions/ldm.c Richard Knutsson 2006-09-30  153  		return false;
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  154  	}
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  155  	ldm_debug ("Parsed TOCBLOCK successfully.");
130c6b98984a05 fs/partitions/ldm.c Richard Knutsson 2006-09-30  156  	return true;
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  157  }
^1da177e4c3f41 fs/partitions/ldm.c Linus Torvalds   2005-04-16  158  

:::::: The code at line 134 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@...970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@...970.osdl.org>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ