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>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202411220837.yUJtt1Lg-lkp@intel.com>
Date: Fri, 22 Nov 2024 08:21:23 +0800
From: kernel test robot <lkp@...el.com>
To: Dan Carpenter <error27@...il.com>, Kees Cook <kees@...nel.org>
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
	"Gustavo A. R. Silva" <gustavoars@...nel.org>,
	linux-hardening@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] overflow: improve size_add/mul for 32bit systems

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@...el.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ