linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* block/partitions/ldm.c:134:9: warning: 'strncpy' specified bound 16 equals destination size
@ 2021-09-08 21:42 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-09-08 21:42 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: kbuild-all, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 7319 bytes --]

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@intel.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@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 17412 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* block/partitions/ldm.c:134:9: warning: 'strncpy' specified bound 16 equals destination size
@ 2021-11-18 11:43 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-11-18 11:43 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: kbuild-all, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 7369 bytes --]

Hi Heiko,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   42eb8fdac2fc5d62392dcfcf0253753e821a97b0
commit: 334ef6ed06fa1a54e35296b77b693bcf6d63ee9e init/Kconfig: make COMPILE_TEST depend on !S390
date:   12 months ago
config: s390-buildonly-randconfig-r006-20211118 (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@intel.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@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 13908 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* block/partitions/ldm.c:134:9: warning: 'strncpy' specified bound 16 equals destination size
@ 2021-10-15  9:22 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-10-15  9:22 UTC (permalink / raw)
  To: Heiko Carstens; +Cc: kbuild-all, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 7956 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ec681c53f8d2d0ee362ff67f5b98dd8263c15002
commit: 334ef6ed06fa1a54e35296b77b693bcf6d63ee9e init/Kconfig: make COMPILE_TEST depend on !S390
date:   11 months ago
config: s390-randconfig-r044-20211015 (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@intel.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));
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
   kernel/trace/blktrace.c: In function '__trace_note_message':
   kernel/trace/blktrace.c:148:63: warning: parameter 'blkcg' set but not used [-Wunused-but-set-parameter]
     148 | void __trace_note_message(struct blk_trace *bt, struct blkcg *blkcg,
         |                                                 ~~~~~~~~~~~~~~^~~~~
   kernel/trace/blktrace.c: In function 'do_blk_trace_setup':
>> kernel/trace/blktrace.c:491:9: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
     491 |         strncpy(buts->name, name, BLKTRACE_BDEV_SIZE);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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@ppc970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@ppc970.osdl.org>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 14041 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-18 11:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 21:42 block/partitions/ldm.c:134:9: warning: 'strncpy' specified bound 16 equals destination size kernel test robot
2021-10-15  9:22 kernel test robot
2021-11-18 11:43 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).