Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* Re: [PATCH] overflow: improve size_add/mul for 32bit systems
       [not found] <ebdae636-11f3-4f02-a158-f15bbed2847f@stanley.mountain>
@ 2024-11-21 20:30 ` kernel test robot
  2024-11-22  0:21 ` kernel test robot
  1 sibling, 0 replies; 2+ messages in thread
From: kernel test robot @ 2024-11-21 20:30 UTC (permalink / raw)
  To: Dan Carpenter, Kees Cook
  Cc: llvm, oe-kbuild-all, Gustavo A. R. Silva, linux-hardening,
	linux-kernel

Hi Dan,

kernel test robot noticed the following build warnings:

[auto build test WARNING on kees/for-next/hardening]
[also build test WARNING on kees/for-next/pstore kees/for-next/kspp linus/master v6.12 next-20241121]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Dan-Carpenter/overflow-improve-size_add-mul-for-32bit-systems/20241121-124847
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
patch link:    https://lore.kernel.org/r/ebdae636-11f3-4f02-a158-f15bbed2847f%40stanley.mountain
patch subject: [PATCH] overflow: improve size_add/mul for 32bit systems
config: arm-allnoconfig (https://download.01.org/0day-ci/archive/20241122/202411220455.2X9OAAvt-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241122/202411220455.2X9OAAvt-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411220455.2X9OAAvt-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from block/bio.c:5:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> block/bio.c:616:17: warning: result of comparison of constant 4294967295 with expression of type 'typeof (nr_vecs)' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
     616 |         return kmalloc(struct_size(bio, bi_inline_vecs, nr_vecs), gfp_mask);
         |                ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/slab.h:884:52: note: expanded from macro 'kmalloc'
     884 | #define kmalloc(...)                            alloc_hooks(kmalloc_noprof(__VA_ARGS__))
         |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
   include/linux/alloc_tag.h:210:31: note: expanded from macro 'alloc_hooks'
     210 |         alloc_hooks_tag(&_alloc_tag, _do_alloc);                        \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   include/linux/alloc_tag.h:202:27: note: expanded from macro 'alloc_hooks_tag'
     202 |         typeof(_do_alloc) _res = _do_alloc;                             \
         |                                  ^~~~~~~~~
>> block/bio.c:616:17: warning: result of comparison of constant 4294967295 with expression of type 'typeof (nr_vecs)' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
     616 |         return kmalloc(struct_size(bio, bi_inline_vecs, nr_vecs), gfp_mask);
         |                ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/slab.h:884:52: note: expanded from macro 'kmalloc'
     884 | #define kmalloc(...)                            alloc_hooks(kmalloc_noprof(__VA_ARGS__))
         |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
   include/linux/alloc_tag.h:210:31: note: expanded from macro 'alloc_hooks'
     210 |         alloc_hooks_tag(&_alloc_tag, _do_alloc);                        \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   include/linux/alloc_tag.h:202:27: note: expanded from macro 'alloc_hooks_tag'
     202 |         typeof(_do_alloc) _res = _do_alloc;                             \
         |                                  ^~~~~~~~~
   3 warnings generated.


vim +616 block/bio.c

^1da177e4c3f41 fs/bio.c    Linus Torvalds    2005-04-16  593  
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  594  /**
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06  595   * bio_kmalloc - kmalloc a bio
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06  596   * @nr_vecs:	number of bio_vecs to allocate
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  597   * @gfp_mask:   the GFP_* mask given to the slab allocator
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  598   *
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06  599   * Use kmalloc to allocate a bio (including bvecs).  The bio must be initialized
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06  600   * using bio_init() before use.  To free a bio returned from this function use
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06  601   * kfree() after calling bio_uninit().  A bio returned from this function can
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06  602   * be reused by calling bio_uninit() before calling bio_init() again.
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06  603   *
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06  604   * Note that unlike bio_alloc() or bio_alloc_bioset() allocations from this
340e134727c9ad block/bio.c Deming Wang       2022-10-06  605   * function are not backed by a mempool can fail.  Do not use this function
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06  606   * for allocations in the file system I/O path.
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  607   *
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  608   * Returns: Pointer to new bio on success, NULL on failure.
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  609   */
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06  610  struct bio *bio_kmalloc(unsigned short nr_vecs, gfp_t gfp_mask)
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  611  {
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  612  	struct bio *bio;
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  613  
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06  614  	if (nr_vecs > UIO_MAXIOV)
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  615  		return NULL;
066ff571011d84 block/bio.c Christoph Hellwig 2022-04-06 @616  	return kmalloc(struct_size(bio, bi_inline_vecs, nr_vecs), gfp_mask);
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  617  }
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  618  EXPORT_SYMBOL(bio_kmalloc);
3175199ab0ac8c block/bio.c Christoph Hellwig 2021-01-26  619  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH] overflow: improve size_add/mul for 32bit systems
       [not found] <ebdae636-11f3-4f02-a158-f15bbed2847f@stanley.mountain>
  2024-11-21 20:30 ` [PATCH] overflow: improve size_add/mul for 32bit systems kernel test robot
@ 2024-11-22  0:21 ` kernel test robot
  1 sibling, 0 replies; 2+ messages in thread
From: kernel test robot @ 2024-11-22  0:21 UTC (permalink / raw)
  To: Dan Carpenter, Kees Cook
  Cc: llvm, oe-kbuild-all, Gustavo A. R. Silva, linux-hardening,
	linux-kernel

Hi Dan,

kernel test robot noticed the following build errors:

[auto build test ERROR on kees/for-next/hardening]
[also build test ERROR on kees/for-next/pstore kees/for-next/kspp linus/master v6.12 next-20241121]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Dan-Carpenter/overflow-improve-size_add-mul-for-32bit-systems/20241121-124847
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening
patch link:    https://lore.kernel.org/r/ebdae636-11f3-4f02-a158-f15bbed2847f%40stanley.mountain
patch subject: [PATCH] overflow: improve size_add/mul for 32bit systems
config: i386-randconfig-002-20241122 (https://download.01.org/0day-ci/archive/20241122/202411220837.yUJtt1Lg-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241122/202411220837.yUJtt1Lg-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411220837.yUJtt1Lg-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from drivers/hv/vmbus_drv.c:21:
   In file included from include/linux/hyperv.h:17:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> drivers/hv/vmbus_drv.c:1078:17: warning: result of comparison of constant 4294967295 with expression of type 'typeof (payload_size)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    1078 |                 ctx = kmalloc(struct_size(ctx, msg.payload, payload_size), GFP_ATOMIC);
         |                       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/slab.h:884:52: note: expanded from macro 'kmalloc'
     884 | #define kmalloc(...)                            alloc_hooks(kmalloc_noprof(__VA_ARGS__))
         |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
   include/linux/alloc_tag.h:210:31: note: expanded from macro 'alloc_hooks'
     210 |         alloc_hooks_tag(&_alloc_tag, _do_alloc);                        \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   include/linux/alloc_tag.h:202:27: note: expanded from macro 'alloc_hooks_tag'
     202 |         typeof(_do_alloc) _res = _do_alloc;                             \
         |                                  ^~~~~~~~~
>> drivers/hv/vmbus_drv.c:1078:17: warning: result of comparison of constant 4294967295 with expression of type 'typeof (payload_size)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    1078 |                 ctx = kmalloc(struct_size(ctx, msg.payload, payload_size), GFP_ATOMIC);
         |                       ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/slab.h:884:52: note: expanded from macro 'kmalloc'
     884 | #define kmalloc(...)                            alloc_hooks(kmalloc_noprof(__VA_ARGS__))
         |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
   include/linux/alloc_tag.h:210:31: note: expanded from macro 'alloc_hooks'
     210 |         alloc_hooks_tag(&_alloc_tag, _do_alloc);                        \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   include/linux/alloc_tag.h:202:27: note: expanded from macro 'alloc_hooks_tag'
     202 |         typeof(_do_alloc) _res = _do_alloc;                             \
         |                                  ^~~~~~~~~
   3 warnings generated.
--
   In file included from drivers/scsi/mpt3sas/mpt3sas_warpdrive.c:47:
   In file included from drivers/scsi/mpt3sas/mpt3sas_base.h:61:
   In file included from include/scsi/scsi_cmnd.h:5:
   In file included from include/linux/dma-mapping.h:11:
   In file included from include/linux/scatterlist.h:8:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> drivers/scsi/mpt3sas/mpt3sas_warpdrive.c:144:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (num_pds)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
     144 |         sz = struct_size(vol_pg0, PhysDisk, num_pds);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^  ~~~~~~~~~~~~~
>> drivers/scsi/mpt3sas/mpt3sas_warpdrive.c:144:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (num_pds)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
     144 |         sz = struct_size(vol_pg0, PhysDisk, num_pds);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/overflow.h:309:19: note: expanded from macro 'size_add'
     309 |         typeof(b) __b = (b);                                            \
         |                          ^
   3 warnings generated.
--
   In file included from drivers/scsi/mpt3sas/mpt3sas_transport.c:52:
   In file included from include/linux/pci.h:1650:
   In file included from include/linux/dmapool.h:14:
   In file included from include/linux/scatterlist.h:8:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> drivers/scsi/mpt3sas/mpt3sas_transport.c:1791:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    1791 |         sz = struct_size(sas_iounit_pg0, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^  ~~~~~~~~~~~~~
>> drivers/scsi/mpt3sas/mpt3sas_transport.c:1791:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    1791 |         sz = struct_size(sas_iounit_pg0, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/overflow.h:309:19: note: expanded from macro 'size_add'
     309 |         typeof(b) __b = (b);                                            \
         |                          ^
   drivers/scsi/mpt3sas/mpt3sas_transport.c:1831:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    1831 |         sz = struct_size(sas_iounit_pg1, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^  ~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_transport.c:1831:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    1831 |         sz = struct_size(sas_iounit_pg1, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/overflow.h:309:19: note: expanded from macro 'size_add'
     309 |         typeof(b) __b = (b);                                            \
         |                          ^
   drivers/scsi/mpt3sas/mpt3sas_transport.c:1941:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    1941 |         sz = struct_size(sas_iounit_pg1, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^  ~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_transport.c:1941:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    1941 |         sz = struct_size(sas_iounit_pg1, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/overflow.h:309:19: note: expanded from macro 'size_add'
     309 |         typeof(b) __b = (b);                                            \
         |                          ^
   7 warnings generated.
--
   In file included from drivers/scsi/mpt3sas/mpt3sas_base.c:52:
   In file included from include/linux/pci.h:1650:
   In file included from include/linux/dmapool.h:14:
   In file included from include/linux/scatterlist.h:8:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> drivers/scsi/mpt3sas/mpt3sas_base.c:4912:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    4912 |         sz = struct_size(sas_iounit_pg1, PhyData, num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^  ~~~~~~~~~~~~~
>> drivers/scsi/mpt3sas/mpt3sas_base.c:4912:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    4912 |         sz = struct_size(sas_iounit_pg1, PhyData, num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/overflow.h:309:19: note: expanded from macro 'size_add'
     309 |         typeof(b) __b = (b);                                            \
         |                          ^
   3 warnings generated.
--
   In file included from drivers/scsi/mpt3sas/mpt3sas_scsih.c:49:
   In file included from include/linux/blkdev.h:9:
   In file included from include/linux/blk_types.h:10:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:8:
   In file included from include/linux/cacheflush.h:5:
   In file included from arch/x86/include/asm/cacheflush.h:5:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> drivers/scsi/mpt3sas/mpt3sas_scsih.c:2434:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (num_pds)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    2434 |         sz = struct_size(vol_pg0, PhysDisk, num_pds);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^  ~~~~~~~~~~~~~
>> drivers/scsi/mpt3sas/mpt3sas_scsih.c:2434:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (num_pds)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    2434 |         sz = struct_size(vol_pg0, PhysDisk, num_pds);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/overflow.h:309:19: note: expanded from macro 'size_add'
     309 |         typeof(b) __b = (b);                                            \
         |                          ^
>> drivers/scsi/mpt3sas/mpt3sas_scsih.c:5960:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    5960 |         sz = struct_size(sas_iounit_pg0, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^  ~~~~~~~~~~~~~
>> drivers/scsi/mpt3sas/mpt3sas_scsih.c:5960:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    5960 |         sz = struct_size(sas_iounit_pg0, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/overflow.h:309:19: note: expanded from macro 'size_add'
     309 |         typeof(b) __b = (b);                                            \
         |                          ^
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:6138:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    6138 |         sz = struct_size(sas_iounit_pg0, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^  ~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:6138:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    6138 |         sz = struct_size(sas_iounit_pg0, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/overflow.h:309:19: note: expanded from macro 'size_add'
     309 |         typeof(b) __b = (b);                                            \
         |                          ^
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:6571:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    6571 |         sz = struct_size(sas_iounit_pg0, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^  ~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:6571:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    6571 |         sz = struct_size(sas_iounit_pg0, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/overflow.h:309:19: note: expanded from macro 'size_add'
     309 |         typeof(b) __b = (b);                                            \
         |                          ^
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:6722:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    6722 |         sz = struct_size(sas_iounit_pg0, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^  ~~~~~~~~~~~~~
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:6722:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    6722 |         sz = struct_size(sas_iounit_pg0, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:397:26: note: expanded from macro 'struct_size'
     397 |                 size_add(sizeof(*(p)), flex_array_size(p, member, count)))
         |                 ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:381:3: note: expanded from macro 'flex_array_size'
     381 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:281:11: note: expanded from macro 'size_mul'
     281 |             (__a >= (u64)SIZE_MAX || __b >= (u64)SIZE_MAX))             \
         |              ~~~ ^
   include/linux/overflow.h:309:19: note: expanded from macro 'size_add'
     309 |         typeof(b) __b = (b);                                            \
         |                          ^
   drivers/scsi/mpt3sas/mpt3sas_scsih.c:6744:7: warning: result of comparison of constant 4294967295 with expression of type 'typeof (ioc->sas_hba.num_phys)' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare]
    6744 |         sz = struct_size(sas_iounit_pg1, PhyData, ioc->sas_hba.num_phys);
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:396:18: note: expanded from macro 'struct_size'
     396 |                 sizeof(*(p)) + flex_array_size(p, member, count),       \
..


vim +117 drivers/gpu/drm/nouveau/nvif/mmu.c

eea5cf0f0170fb Ben Skeggs          2017-11-01   38  
eea5cf0f0170fb Ben Skeggs          2017-11-01   39  int
b495396cc9ccf5 Ben Skeggs          2020-03-30   40  nvif_mmu_ctor(struct nvif_object *parent, const char *name, s32 oclass,
b495396cc9ccf5 Ben Skeggs          2020-03-30   41  	      struct nvif_mmu *mmu)
eea5cf0f0170fb Ben Skeggs          2017-11-01   42  {
f5650478ab07c0 Ben Skeggs          2018-05-08   43  	static const struct nvif_mclass mems[] = {
f5650478ab07c0 Ben Skeggs          2018-05-08   44  		{ NVIF_CLASS_MEM_GF100, -1 },
f5650478ab07c0 Ben Skeggs          2018-05-08   45  		{ NVIF_CLASS_MEM_NV50 , -1 },
f5650478ab07c0 Ben Skeggs          2018-05-08   46  		{ NVIF_CLASS_MEM_NV04 , -1 },
f5650478ab07c0 Ben Skeggs          2018-05-08   47  		{}
f5650478ab07c0 Ben Skeggs          2018-05-08   48  	};
eea5cf0f0170fb Ben Skeggs          2017-11-01   49  	struct nvif_mmu_v0 args;
eea5cf0f0170fb Ben Skeggs          2017-11-01   50  	int ret, i;
eea5cf0f0170fb Ben Skeggs          2017-11-01   51  
eea5cf0f0170fb Ben Skeggs          2017-11-01   52  	args.version = 0;
eea5cf0f0170fb Ben Skeggs          2017-11-01   53  	mmu->heap = NULL;
eea5cf0f0170fb Ben Skeggs          2017-11-01   54  	mmu->type = NULL;
eea5cf0f0170fb Ben Skeggs          2017-11-01   55  	mmu->kind = NULL;
eea5cf0f0170fb Ben Skeggs          2017-11-01   56  
b495396cc9ccf5 Ben Skeggs          2020-03-30   57  	ret = nvif_object_ctor(parent, name ? name : "nvifMmu", 0, oclass,
b495396cc9ccf5 Ben Skeggs          2020-03-30   58  			       &args, sizeof(args), &mmu->object);
eea5cf0f0170fb Ben Skeggs          2017-11-01   59  	if (ret)
eea5cf0f0170fb Ben Skeggs          2017-11-01   60  		goto done;
eea5cf0f0170fb Ben Skeggs          2017-11-01   61  
eea5cf0f0170fb Ben Skeggs          2017-11-01   62  	mmu->dmabits = args.dmabits;
eea5cf0f0170fb Ben Skeggs          2017-11-01   63  	mmu->heap_nr = args.heap_nr;
eea5cf0f0170fb Ben Skeggs          2017-11-01   64  	mmu->type_nr = args.type_nr;
eea5cf0f0170fb Ben Skeggs          2017-11-01   65  	mmu->kind_nr = args.kind_nr;
eea5cf0f0170fb Ben Skeggs          2017-11-01   66  
f5650478ab07c0 Ben Skeggs          2018-05-08   67  	ret = nvif_mclass(&mmu->object, mems);
f5650478ab07c0 Ben Skeggs          2018-05-08   68  	if (ret < 0)
f5650478ab07c0 Ben Skeggs          2018-05-08   69  		goto done;
f5650478ab07c0 Ben Skeggs          2018-05-08   70  	mmu->mem = mems[ret].oclass;
f5650478ab07c0 Ben Skeggs          2018-05-08   71  
6da2ec56059c3c Kees Cook           2018-06-12   72  	mmu->heap = kmalloc_array(mmu->heap_nr, sizeof(*mmu->heap),
6da2ec56059c3c Kees Cook           2018-06-12   73  				  GFP_KERNEL);
6da2ec56059c3c Kees Cook           2018-06-12   74  	mmu->type = kmalloc_array(mmu->type_nr, sizeof(*mmu->type),
6da2ec56059c3c Kees Cook           2018-06-12   75  				  GFP_KERNEL);
eea5cf0f0170fb Ben Skeggs          2017-11-01   76  	if (ret = -ENOMEM, !mmu->heap || !mmu->type)
eea5cf0f0170fb Ben Skeggs          2017-11-01   77  		goto done;
eea5cf0f0170fb Ben Skeggs          2017-11-01   78  
6da2ec56059c3c Kees Cook           2018-06-12   79  	mmu->kind = kmalloc_array(mmu->kind_nr, sizeof(*mmu->kind),
6da2ec56059c3c Kees Cook           2018-06-12   80  				  GFP_KERNEL);
eea5cf0f0170fb Ben Skeggs          2017-11-01   81  	if (!mmu->kind && mmu->kind_nr)
eea5cf0f0170fb Ben Skeggs          2017-11-01   82  		goto done;
eea5cf0f0170fb Ben Skeggs          2017-11-01   83  
eea5cf0f0170fb Ben Skeggs          2017-11-01   84  	for (i = 0; i < mmu->heap_nr; i++) {
eea5cf0f0170fb Ben Skeggs          2017-11-01   85  		struct nvif_mmu_heap_v0 args = { .index = i };
eea5cf0f0170fb Ben Skeggs          2017-11-01   86  
eea5cf0f0170fb Ben Skeggs          2017-11-01   87  		ret = nvif_object_mthd(&mmu->object, NVIF_MMU_V0_HEAP,
eea5cf0f0170fb Ben Skeggs          2017-11-01   88  				       &args, sizeof(args));
eea5cf0f0170fb Ben Skeggs          2017-11-01   89  		if (ret)
eea5cf0f0170fb Ben Skeggs          2017-11-01   90  			goto done;
eea5cf0f0170fb Ben Skeggs          2017-11-01   91  
eea5cf0f0170fb Ben Skeggs          2017-11-01   92  		mmu->heap[i].size = args.size;
eea5cf0f0170fb Ben Skeggs          2017-11-01   93  	}
eea5cf0f0170fb Ben Skeggs          2017-11-01   94  
eea5cf0f0170fb Ben Skeggs          2017-11-01   95  	for (i = 0; i < mmu->type_nr; i++) {
eea5cf0f0170fb Ben Skeggs          2017-11-01   96  		struct nvif_mmu_type_v0 args = { .index = i };
eea5cf0f0170fb Ben Skeggs          2017-11-01   97  
eea5cf0f0170fb Ben Skeggs          2017-11-01   98  		ret = nvif_object_mthd(&mmu->object, NVIF_MMU_V0_TYPE,
eea5cf0f0170fb Ben Skeggs          2017-11-01   99  				       &args, sizeof(args));
eea5cf0f0170fb Ben Skeggs          2017-11-01  100  		if (ret)
eea5cf0f0170fb Ben Skeggs          2017-11-01  101  			goto done;
eea5cf0f0170fb Ben Skeggs          2017-11-01  102  
eea5cf0f0170fb Ben Skeggs          2017-11-01  103  		mmu->type[i].type = 0;
eea5cf0f0170fb Ben Skeggs          2017-11-01  104  		if (args.vram) mmu->type[i].type |= NVIF_MEM_VRAM;
eea5cf0f0170fb Ben Skeggs          2017-11-01  105  		if (args.host) mmu->type[i].type |= NVIF_MEM_HOST;
eea5cf0f0170fb Ben Skeggs          2017-11-01  106  		if (args.comp) mmu->type[i].type |= NVIF_MEM_COMP;
eea5cf0f0170fb Ben Skeggs          2017-11-01  107  		if (args.disp) mmu->type[i].type |= NVIF_MEM_DISP;
eea5cf0f0170fb Ben Skeggs          2017-11-01  108  		if (args.kind    ) mmu->type[i].type |= NVIF_MEM_KIND;
eea5cf0f0170fb Ben Skeggs          2017-11-01  109  		if (args.mappable) mmu->type[i].type |= NVIF_MEM_MAPPABLE;
eea5cf0f0170fb Ben Skeggs          2017-11-01  110  		if (args.coherent) mmu->type[i].type |= NVIF_MEM_COHERENT;
eea5cf0f0170fb Ben Skeggs          2017-11-01  111  		if (args.uncached) mmu->type[i].type |= NVIF_MEM_UNCACHED;
eea5cf0f0170fb Ben Skeggs          2017-11-01  112  		mmu->type[i].heap = args.heap;
eea5cf0f0170fb Ben Skeggs          2017-11-01  113  	}
eea5cf0f0170fb Ben Skeggs          2017-11-01  114  
eea5cf0f0170fb Ben Skeggs          2017-11-01  115  	if (mmu->kind_nr) {
eea5cf0f0170fb Ben Skeggs          2017-11-01  116  		struct nvif_mmu_kind_v0 *kind;
7b97492555b106 Gustavo A. R. Silva 2019-05-24 @117  		size_t argc = struct_size(kind, data, mmu->kind_nr);

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2024-11-22  0:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <ebdae636-11f3-4f02-a158-f15bbed2847f@stanley.mountain>
2024-11-21 20:30 ` [PATCH] overflow: improve size_add/mul for 32bit systems kernel test robot
2024-11-22  0:21 ` 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