[rafael-pm:thermal-core-testing 7/23] drivers/thermal/testing/zone.c:405:31: warning: 'kmalloc_array_noprof' sizes specified with 'sizeof' in the earlier argument and not in the later argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git thermal-core-testing
head:   b7e46a95eece4ca15b1656c3c45323068642d11a
commit: e89b27c5a79c07b289c3bf1b32bba376f6fa5b7e [7/23] thermal: Introduce a debugfs-based testing facility
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20240820/202408201147.hRhwCUcp-lkp@xxxxxxxxx/config)
compiler: sh4-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240820/202408201147.hRhwCUcp-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408201147.hRhwCUcp-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   In file included from include/linux/percpu.h:5,
                    from include/linux/percpu_counter.h:14,
                    from include/linux/mm_types.h:21,
                    from include/linux/mmzone.h:22,
                    from include/linux/gfp.h:7,
                    from include/linux/xarray.h:16,
                    from include/linux/list_lru.h:14,
                    from include/linux/fs.h:13,
                    from include/linux/debugfs.h:15,
                    from drivers/thermal/testing/zone.c:12:
   drivers/thermal/testing/zone.c: In function 'tt_zone_register_tz':
>> drivers/thermal/testing/zone.c:405:31: warning: 'kmalloc_array_noprof' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
     405 |         trips = kcalloc(sizeof(*trips), tt_zone->num_trips, GFP_KERNEL);
         |                               ^
   include/linux/alloc_tag.h:206:16: note: in definition of macro 'alloc_hooks_tag'
     206 |         typeof(_do_alloc) _res = _do_alloc;                             \
         |                ^~~~~~~~~
   include/linux/slab.h:728:49: note: in expansion of macro 'alloc_hooks'
     728 | #define kmalloc_array(...)                      alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))
         |                                                 ^~~~~~~~~~~
   include/linux/slab.h:757:41: note: in expansion of macro 'kmalloc_array'
     757 | #define kcalloc(n, size, flags)         kmalloc_array(n, size, (flags) | __GFP_ZERO)
         |                                         ^~~~~~~~~~~~~
   drivers/thermal/testing/zone.c:405:17: note: in expansion of macro 'kcalloc'
     405 |         trips = kcalloc(sizeof(*trips), tt_zone->num_trips, GFP_KERNEL);
         |                 ^~~~~~~
   drivers/thermal/testing/zone.c:405:31: note: earlier argument should specify number of elements, later size of each element
     405 |         trips = kcalloc(sizeof(*trips), tt_zone->num_trips, GFP_KERNEL);
         |                               ^
   include/linux/alloc_tag.h:206:16: note: in definition of macro 'alloc_hooks_tag'
     206 |         typeof(_do_alloc) _res = _do_alloc;                             \
         |                ^~~~~~~~~
   include/linux/slab.h:728:49: note: in expansion of macro 'alloc_hooks'
     728 | #define kmalloc_array(...)                      alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))
         |                                                 ^~~~~~~~~~~
   include/linux/slab.h:757:41: note: in expansion of macro 'kmalloc_array'
     757 | #define kcalloc(n, size, flags)         kmalloc_array(n, size, (flags) | __GFP_ZERO)
         |                                         ^~~~~~~~~~~~~
   drivers/thermal/testing/zone.c:405:17: note: in expansion of macro 'kcalloc'
     405 |         trips = kcalloc(sizeof(*trips), tt_zone->num_trips, GFP_KERNEL);
         |                 ^~~~~~~
>> drivers/thermal/testing/zone.c:405:31: warning: 'kmalloc_array_noprof' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
     405 |         trips = kcalloc(sizeof(*trips), tt_zone->num_trips, GFP_KERNEL);
         |                               ^
   include/linux/alloc_tag.h:206:34: note: in definition of macro 'alloc_hooks_tag'
     206 |         typeof(_do_alloc) _res = _do_alloc;                             \
         |                                  ^~~~~~~~~
   include/linux/slab.h:728:49: note: in expansion of macro 'alloc_hooks'
     728 | #define kmalloc_array(...)                      alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))
         |                                                 ^~~~~~~~~~~
   include/linux/slab.h:757:41: note: in expansion of macro 'kmalloc_array'
     757 | #define kcalloc(n, size, flags)         kmalloc_array(n, size, (flags) | __GFP_ZERO)
         |                                         ^~~~~~~~~~~~~
   drivers/thermal/testing/zone.c:405:17: note: in expansion of macro 'kcalloc'
     405 |         trips = kcalloc(sizeof(*trips), tt_zone->num_trips, GFP_KERNEL);
         |                 ^~~~~~~
   drivers/thermal/testing/zone.c:405:31: note: earlier argument should specify number of elements, later size of each element
     405 |         trips = kcalloc(sizeof(*trips), tt_zone->num_trips, GFP_KERNEL);
         |                               ^
   include/linux/alloc_tag.h:206:34: note: in definition of macro 'alloc_hooks_tag'
     206 |         typeof(_do_alloc) _res = _do_alloc;                             \
         |                                  ^~~~~~~~~
   include/linux/slab.h:728:49: note: in expansion of macro 'alloc_hooks'
     728 | #define kmalloc_array(...)                      alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))
         |                                                 ^~~~~~~~~~~
   include/linux/slab.h:757:41: note: in expansion of macro 'kmalloc_array'
     757 | #define kcalloc(n, size, flags)         kmalloc_array(n, size, (flags) | __GFP_ZERO)
         |                                         ^~~~~~~~~~~~~
   drivers/thermal/testing/zone.c:405:17: note: in expansion of macro 'kcalloc'
     405 |         trips = kcalloc(sizeof(*trips), tt_zone->num_trips, GFP_KERNEL);
         |                 ^~~~~~~
--
>> drivers/thermal/testing/zone.c:52: warning: Function parameter or struct member 'refcount' not described in 'tt_thermal_zone'
>> drivers/thermal/testing/zone.c:52: warning: Excess struct member 'refcont' description in 'tt_thermal_zone'
>> drivers/thermal/testing/zone.c:71: warning: Excess struct member 'tt_zone' description in 'tt_trip'


vim +405 drivers/thermal/testing/zone.c

   392	
   393	static int tt_zone_register_tz(struct tt_thermal_zone *tt_zone)
   394	{
   395		struct thermal_trip *trips __free(kfree);
   396		struct thermal_zone_device *tz;
   397		struct tt_trip *tt_trip;
   398		int i;
   399	
   400		guard(tt_zone)(tt_zone);
   401	
   402		if (tt_zone->tz)
   403			return -EINVAL;
   404	
 > 405		trips = kcalloc(sizeof(*trips), tt_zone->num_trips, GFP_KERNEL);
   406		if (!trips)
   407			return -ENOMEM;
   408	
   409		i = 0;
   410		list_for_each_entry(tt_trip, &tt_zone->trips, list_node)
   411			trips[i++] = tt_trip->trip;
   412	
   413		tt_zone->tz_temp = tt_zone->temp;
   414	
   415		tz = thermal_zone_device_register_with_trips("test_tz", trips, i, tt_zone,
   416							     &tt_zone_ops, NULL, 0, 0);
   417		if (IS_ERR(tz))
   418			return PTR_ERR(tz);
   419	
   420		tt_zone->tz = tz;
   421	
   422		thermal_zone_device_enable(tz);
   423	
   424		return 0;
   425	}
   426	

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




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]
  Powered by Linux