All of lore.kernel.org
 help / color / mirror / Atom feed
* [kees:for-next/overflow 30/30] fs/udf/super.c:2525:61: warning: array subscript '__builtin_bswap32 (_61) + 4294967295' is outside the bounds of an interior zero-length array '__le32[0]' {aka 'unsigned int[]'}
@ 2021-08-26  9:31 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-08-26  9:31 UTC (permalink / raw)
  To: Kees Cook; +Cc: kbuild-all, linux-kernel

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/overflow
head:   7d8aac16a0a831d3ce4948ed18d812ad2e2224ac
commit: 7d8aac16a0a831d3ce4948ed18d812ad2e2224ac [30/30] Makefile: Enable -Wzero-length-bounds
config: s390-allyesconfig (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/kees/linux.git/commit/?id=7d8aac16a0a831d3ce4948ed18d812ad2e2224ac
        git remote add kees https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
        git fetch --no-tags kees for-next/overflow
        git checkout 7d8aac16a0a831d3ce4948ed18d812ad2e2224ac
        # 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 file included from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/big_endian.h:13,
                    from include/linux/byteorder/big_endian.h:5,
                    from arch/s390/include/uapi/asm/byteorder.h:5,
                    from include/asm-generic/bitops/le.h:7,
                    from arch/s390/include/asm/bitops.h:393,
                    from include/linux/bitops.h:32,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/wait.h:7,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from fs/udf/udfdecl.h:10,
                    from fs/udf/super.c:41:
   fs/udf/super.c: In function 'udf_statfs':
>> fs/udf/super.c:2525:61: warning: array subscript '__builtin_bswap32 (_61) + 4294967295' is outside the bounds of an interior zero-length array '__le32[0]' {aka 'unsigned int[]'} [-Wzero-length-bounds]
    2525 |                                         lvid->freeSpaceTable[part]);
   include/uapi/linux/swab.h:115:54: note: in definition of macro '__swab32'
     115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
         |                                                      ^
   include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__le32_to_cpu'
      89 | #define le32_to_cpu __le32_to_cpu
         |                     ^~~~~~~~~~~~~
   fs/udf/super.c:2524:33: note: in expansion of macro 'le32_to_cpu'
    2524 |                         accum = le32_to_cpu(
         |                                 ^~~~~~~~~~~
   In file included from fs/udf/udfdecl.h:7,
                    from fs/udf/super.c:41:
   fs/udf/ecma_167.h:363:33: note: while referencing 'freeSpaceTable'
     363 |         __le32                  freeSpaceTable[0];
         |                                 ^~~~~~~~~~~~~~


vim +2525 fs/udf/super.c

^1da177e4c3f4152 Linus Torvalds   2005-04-16  2499  
cb00ea3528eb3c09 Cyrill Gorcunov  2007-07-19  2500  static unsigned int udf_count_free(struct super_block *sb)
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2501  {
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2502  	unsigned int accum = 0;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2503  	struct udf_sb_info *sbi = UDF_SB(sb);
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2504  	struct udf_part_map *map;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2505  	unsigned int part = sbi->s_partition;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2506  	int ptype = sbi->s_partmaps[part].s_partition_type;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2507  
a4a8b99ec819ca60 Jan Kara         2020-01-07  2508  	if (ptype == UDF_METADATA_MAP25) {
a4a8b99ec819ca60 Jan Kara         2020-01-07  2509  		part = sbi->s_partmaps[part].s_type_specific.s_metadata.
a4a8b99ec819ca60 Jan Kara         2020-01-07  2510  							s_phys_partition_ref;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2511  	} else if (ptype == UDF_VIRTUAL_MAP15 || ptype == UDF_VIRTUAL_MAP20) {
a4a8b99ec819ca60 Jan Kara         2020-01-07  2512  		/*
a4a8b99ec819ca60 Jan Kara         2020-01-07  2513  		 * Filesystems with VAT are append-only and we cannot write to
a4a8b99ec819ca60 Jan Kara         2020-01-07  2514   		 * them. Let's just report 0 here.
a4a8b99ec819ca60 Jan Kara         2020-01-07  2515  		 */
a4a8b99ec819ca60 Jan Kara         2020-01-07  2516  		return 0;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2517  	}
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2518  
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2519  	if (sbi->s_lvid_bh) {
4b11111aba6c80cc Marcin Slusarz   2008-02-08  2520  		struct logicalVolIntegrityDesc *lvid =
4b11111aba6c80cc Marcin Slusarz   2008-02-08  2521  			(struct logicalVolIntegrityDesc *)
4b11111aba6c80cc Marcin Slusarz   2008-02-08  2522  			sbi->s_lvid_bh->b_data;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2523  		if (le32_to_cpu(lvid->numOfPartitions) > part) {
4b11111aba6c80cc Marcin Slusarz   2008-02-08  2524  			accum = le32_to_cpu(
a4a8b99ec819ca60 Jan Kara         2020-01-07 @2525  					lvid->freeSpaceTable[part]);
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2526  			if (accum == 0xFFFFFFFF)
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2527  				accum = 0;
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2528  		}
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2529  	}
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2530  
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2531  	if (accum)
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2532  		return accum;
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2533  
a4a8b99ec819ca60 Jan Kara         2020-01-07  2534  	map = &sbi->s_partmaps[part];
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2535  	if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
28de7948a896763b Cyrill Gorcunov  2007-07-21  2536  		accum += udf_count_free_bitmap(sb,
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2537  					       map->s_uspace.s_bitmap);
28de7948a896763b Cyrill Gorcunov  2007-07-21  2538  	}
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2539  	if (accum)
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2540  		return accum;
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2541  
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2542  	if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
28de7948a896763b Cyrill Gorcunov  2007-07-21  2543  		accum += udf_count_free_table(sb,
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2544  					      map->s_uspace.s_table);
28de7948a896763b Cyrill Gorcunov  2007-07-21  2545  	}
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2546  	return accum;
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2547  }
54bb60d53114b834 Fabian Frederick 2017-01-06  2548  

:::::: The code at line 2525 was first introduced by commit
:::::: a4a8b99ec819ca60b49dc582a4287ef03411f117 udf: Fix free space reporting for metadata and virtual partitions

:::::: TO: Jan Kara <jack@suse.cz>
:::::: CC: Jan Kara <jack@suse.cz>

---
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: 66804 bytes --]

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

* [kees:for-next/overflow 30/30] fs/udf/super.c:2525:61: warning: array subscript '__builtin_bswap32 (_61) + 4294967295' is outside the bounds of an interior zero-length array '__le32[0]' {aka 'unsigned int[]'}
@ 2021-08-26  9:31 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-08-26  9:31 UTC (permalink / raw)
  To: kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/overflow
head:   7d8aac16a0a831d3ce4948ed18d812ad2e2224ac
commit: 7d8aac16a0a831d3ce4948ed18d812ad2e2224ac [30/30] Makefile: Enable -Wzero-length-bounds
config: s390-allyesconfig (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/kees/linux.git/commit/?id=7d8aac16a0a831d3ce4948ed18d812ad2e2224ac
        git remote add kees https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git
        git fetch --no-tags kees for-next/overflow
        git checkout 7d8aac16a0a831d3ce4948ed18d812ad2e2224ac
        # 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 file included from include/linux/swab.h:5,
                    from include/uapi/linux/byteorder/big_endian.h:13,
                    from include/linux/byteorder/big_endian.h:5,
                    from arch/s390/include/uapi/asm/byteorder.h:5,
                    from include/asm-generic/bitops/le.h:7,
                    from arch/s390/include/asm/bitops.h:393,
                    from include/linux/bitops.h:32,
                    from include/linux/kernel.h:12,
                    from include/linux/list.h:9,
                    from include/linux/wait.h:7,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from fs/udf/udfdecl.h:10,
                    from fs/udf/super.c:41:
   fs/udf/super.c: In function 'udf_statfs':
>> fs/udf/super.c:2525:61: warning: array subscript '__builtin_bswap32 (_61) + 4294967295' is outside the bounds of an interior zero-length array '__le32[0]' {aka 'unsigned int[]'} [-Wzero-length-bounds]
    2525 |                                         lvid->freeSpaceTable[part]);
   include/uapi/linux/swab.h:115:54: note: in definition of macro '__swab32'
     115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
         |                                                      ^
   include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__le32_to_cpu'
      89 | #define le32_to_cpu __le32_to_cpu
         |                     ^~~~~~~~~~~~~
   fs/udf/super.c:2524:33: note: in expansion of macro 'le32_to_cpu'
    2524 |                         accum = le32_to_cpu(
         |                                 ^~~~~~~~~~~
   In file included from fs/udf/udfdecl.h:7,
                    from fs/udf/super.c:41:
   fs/udf/ecma_167.h:363:33: note: while referencing 'freeSpaceTable'
     363 |         __le32                  freeSpaceTable[0];
         |                                 ^~~~~~~~~~~~~~


vim +2525 fs/udf/super.c

^1da177e4c3f4152 Linus Torvalds   2005-04-16  2499  
cb00ea3528eb3c09 Cyrill Gorcunov  2007-07-19  2500  static unsigned int udf_count_free(struct super_block *sb)
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2501  {
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2502  	unsigned int accum = 0;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2503  	struct udf_sb_info *sbi = UDF_SB(sb);
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2504  	struct udf_part_map *map;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2505  	unsigned int part = sbi->s_partition;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2506  	int ptype = sbi->s_partmaps[part].s_partition_type;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2507  
a4a8b99ec819ca60 Jan Kara         2020-01-07  2508  	if (ptype == UDF_METADATA_MAP25) {
a4a8b99ec819ca60 Jan Kara         2020-01-07  2509  		part = sbi->s_partmaps[part].s_type_specific.s_metadata.
a4a8b99ec819ca60 Jan Kara         2020-01-07  2510  							s_phys_partition_ref;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2511  	} else if (ptype == UDF_VIRTUAL_MAP15 || ptype == UDF_VIRTUAL_MAP20) {
a4a8b99ec819ca60 Jan Kara         2020-01-07  2512  		/*
a4a8b99ec819ca60 Jan Kara         2020-01-07  2513  		 * Filesystems with VAT are append-only and we cannot write to
a4a8b99ec819ca60 Jan Kara         2020-01-07  2514   		 * them. Let's just report 0 here.
a4a8b99ec819ca60 Jan Kara         2020-01-07  2515  		 */
a4a8b99ec819ca60 Jan Kara         2020-01-07  2516  		return 0;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2517  	}
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2518  
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2519  	if (sbi->s_lvid_bh) {
4b11111aba6c80cc Marcin Slusarz   2008-02-08  2520  		struct logicalVolIntegrityDesc *lvid =
4b11111aba6c80cc Marcin Slusarz   2008-02-08  2521  			(struct logicalVolIntegrityDesc *)
4b11111aba6c80cc Marcin Slusarz   2008-02-08  2522  			sbi->s_lvid_bh->b_data;
a4a8b99ec819ca60 Jan Kara         2020-01-07  2523  		if (le32_to_cpu(lvid->numOfPartitions) > part) {
4b11111aba6c80cc Marcin Slusarz   2008-02-08  2524  			accum = le32_to_cpu(
a4a8b99ec819ca60 Jan Kara         2020-01-07 @2525  					lvid->freeSpaceTable[part]);
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2526  			if (accum == 0xFFFFFFFF)
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2527  				accum = 0;
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2528  		}
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2529  	}
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2530  
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2531  	if (accum)
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2532  		return accum;
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2533  
a4a8b99ec819ca60 Jan Kara         2020-01-07  2534  	map = &sbi->s_partmaps[part];
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2535  	if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
28de7948a896763b Cyrill Gorcunov  2007-07-21  2536  		accum += udf_count_free_bitmap(sb,
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2537  					       map->s_uspace.s_bitmap);
28de7948a896763b Cyrill Gorcunov  2007-07-21  2538  	}
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2539  	if (accum)
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2540  		return accum;
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2541  
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2542  	if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
28de7948a896763b Cyrill Gorcunov  2007-07-21  2543  		accum += udf_count_free_table(sb,
6c79e987d629cb0f Marcin Slusarz   2008-02-08  2544  					      map->s_uspace.s_table);
28de7948a896763b Cyrill Gorcunov  2007-07-21  2545  	}
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2546  	return accum;
^1da177e4c3f4152 Linus Torvalds   2005-04-16  2547  }
54bb60d53114b834 Fabian Frederick 2017-01-06  2548  

:::::: The code at line 2525 was first introduced by commit
:::::: a4a8b99ec819ca60b49dc582a4287ef03411f117 udf: Fix free space reporting for metadata and virtual partitions

:::::: TO: Jan Kara <jack@suse.cz>
:::::: CC: Jan Kara <jack@suse.cz>

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

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

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

end of thread, other threads:[~2021-08-26  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26  9:31 [kees:for-next/overflow 30/30] fs/udf/super.c:2525:61: warning: array subscript '__builtin_bswap32 (_61) + 4294967295' is outside the bounds of an interior zero-length array '__le32[0]' {aka 'unsigned int[]'} kernel test robot
2021-08-26  9:31 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.