linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] squashfs: Fix incorrect argument to sizeof in kmalloc_array call
       [not found] <20250708142604.1891156-1-colin.i.king@gmail.com>
@ 2025-07-09  1:05 ` kernel test robot
  2025-07-09  2:54   ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2025-07-09  1:05 UTC (permalink / raw)
  To: Colin Ian King, Phillip Lougher, Chanho Min
  Cc: oe-kbuild-all, kernel-janitors, Andrew Morton,
	Linux Memory Management List, linux-kernel

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

Hi Colin,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]
[also build test ERROR on next-20250708]
[cannot apply to linus/master v6.16-rc5]
[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/Colin-Ian-King/squashfs-Fix-incorrect-argument-to-sizeof-in-kmalloc_array-call/20250708-223017
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20250708142604.1891156-1-colin.i.king%40gmail.com
patch subject: [PATCH] squashfs: Fix incorrect argument to sizeof in kmalloc_array call
:::::: branch date: 10 hours ago
:::::: commit date: 10 hours ago
config: mips-randconfig-r071-20250709 (attached as .config)
compiler: mips64-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (attached as 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/202507090822.QI1bMiUV-lkp@intel.com/

All error/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:14,
                    from include/linux/highmem.h:5,
                    from include/linux/bvec.h:10,
                    from include/linux/blk_types.h:10,
                    from include/linux/blkdev.h:9,
                    from fs/squashfs/block.c:16:
   fs/squashfs/block.c: In function 'squashfs_bio_read_cached':
>> fs/squashfs/block.c:92:12: error: 'folio' undeclared (first use in this function)
       sizeof(*folio), GFP_KERNEL | __GFP_ZERO);
               ^~~~~
   include/linux/alloc_tag.h:239:9: note: in definition of macro 'alloc_hooks_tag'
     typeof(_do_alloc) _res;      \
            ^~~~~~~~~
   include/linux/slab.h:950:30: note: in expansion of macro 'alloc_hooks'
    #define kmalloc_array(...)   alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))
                                 ^~~~~~~~~~~
   fs/squashfs/block.c:91:32: note: in expansion of macro 'kmalloc_array'
     struct folio **cache_folios = kmalloc_array(page_count,
                                   ^~~~~~~~~~~~~
   fs/squashfs/block.c:92:12: note: each undeclared identifier is reported only once for each function it appears in
       sizeof(*folio), GFP_KERNEL | __GFP_ZERO);
               ^~~~~
   include/linux/alloc_tag.h:239:9: note: in definition of macro 'alloc_hooks_tag'
     typeof(_do_alloc) _res;      \
            ^~~~~~~~~
   include/linux/slab.h:950:30: note: in expansion of macro 'alloc_hooks'
    #define kmalloc_array(...)   alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))
                                 ^~~~~~~~~~~
   fs/squashfs/block.c:91:32: note: in expansion of macro 'kmalloc_array'
     struct folio **cache_folios = kmalloc_array(page_count,
                                   ^~~~~~~~~~~~~
>> include/linux/alloc_tag.h:251:1: warning: initialization of 'struct folio **' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    ({         \
    ^
   include/linux/slab.h:950:30: note: in expansion of macro 'alloc_hooks'
    #define kmalloc_array(...)   alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))
                                 ^~~~~~~~~~~
   fs/squashfs/block.c:91:32: note: in expansion of macro 'kmalloc_array'
     struct folio **cache_folios = kmalloc_array(page_count,
                                   ^~~~~~~~~~~~~
--
   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:14,
                    from include/linux/highmem.h:5,
                    from include/linux/bvec.h:10,
                    from include/linux/blk_types.h:10,
                    from include/linux/blkdev.h:9,
                    from block.c:16:
   block.c: In function 'squashfs_bio_read_cached':
   block.c:92:12: error: 'folio' undeclared (first use in this function)
       sizeof(*folio), GFP_KERNEL | __GFP_ZERO);
               ^~~~~
   include/linux/alloc_tag.h:239:9: note: in definition of macro 'alloc_hooks_tag'
     typeof(_do_alloc) _res;      \
            ^~~~~~~~~
   include/linux/slab.h:950:30: note: in expansion of macro 'alloc_hooks'
    #define kmalloc_array(...)   alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))
                                 ^~~~~~~~~~~
   block.c:91:32: note: in expansion of macro 'kmalloc_array'
     struct folio **cache_folios = kmalloc_array(page_count,
                                   ^~~~~~~~~~~~~
   block.c:92:12: note: each undeclared identifier is reported only once for each function it appears in
       sizeof(*folio), GFP_KERNEL | __GFP_ZERO);
               ^~~~~
   include/linux/alloc_tag.h:239:9: note: in definition of macro 'alloc_hooks_tag'
     typeof(_do_alloc) _res;      \
            ^~~~~~~~~
   include/linux/slab.h:950:30: note: in expansion of macro 'alloc_hooks'
    #define kmalloc_array(...)   alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))
                                 ^~~~~~~~~~~
   block.c:91:32: note: in expansion of macro 'kmalloc_array'
     struct folio **cache_folios = kmalloc_array(page_count,
                                   ^~~~~~~~~~~~~
>> include/linux/alloc_tag.h:251:1: warning: initialization of 'struct folio **' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    ({         \
    ^
   include/linux/slab.h:950:30: note: in expansion of macro 'alloc_hooks'
    #define kmalloc_array(...)   alloc_hooks(kmalloc_array_noprof(__VA_ARGS__))
                                 ^~~~~~~~~~~
   block.c:91:32: note: in expansion of macro 'kmalloc_array'
     struct folio **cache_folios = kmalloc_array(page_count,
                                   ^~~~~~~~~~~~~


vim +/folio +92 fs/squashfs/block.c

93e72b3c612adc Philippe Liard          2020-06-01   78  
e994f5b677ee01 Vincent Whitchurch      2023-05-17   79  static int squashfs_bio_read_cached(struct bio *fullbio,
e994f5b677ee01 Vincent Whitchurch      2023-05-17   80  		struct address_space *cache_mapping, u64 index, int length,
e994f5b677ee01 Vincent Whitchurch      2023-05-17   81  		u64 read_start, u64 read_end, int page_count)
e994f5b677ee01 Vincent Whitchurch      2023-05-17   82  {
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12   83) 	struct folio *head_to_cache = NULL, *tail_to_cache = NULL;
e994f5b677ee01 Vincent Whitchurch      2023-05-17   84  	struct block_device *bdev = fullbio->bi_bdev;
e994f5b677ee01 Vincent Whitchurch      2023-05-17   85  	int start_idx = 0, end_idx = 0;
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12   86) 	struct folio_iter fi;;
e994f5b677ee01 Vincent Whitchurch      2023-05-17   87  	struct bio *bio = NULL;
e994f5b677ee01 Vincent Whitchurch      2023-05-17   88  	int idx = 0;
e994f5b677ee01 Vincent Whitchurch      2023-05-17   89  	int err = 0;
2e227ff5e2729b Chanho Min              2025-05-21   90  #ifdef CONFIG_SQUASHFS_COMP_CACHE_FULL
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12   91) 	struct folio **cache_folios = kmalloc_array(page_count,
45eb6ae283427f Colin Ian King          2025-07-08  @92  			sizeof(*folio), GFP_KERNEL | __GFP_ZERO);
2e227ff5e2729b Chanho Min              2025-05-21   93  #endif
e994f5b677ee01 Vincent Whitchurch      2023-05-17   94  
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12   95) 	bio_for_each_folio_all(fi, fullbio) {
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12   96) 		struct folio *folio = fi.folio;
e994f5b677ee01 Vincent Whitchurch      2023-05-17   97  
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12   98) 		if (folio->mapping == cache_mapping) {
e994f5b677ee01 Vincent Whitchurch      2023-05-17   99  			idx++;
e994f5b677ee01 Vincent Whitchurch      2023-05-17  100  			continue;
e994f5b677ee01 Vincent Whitchurch      2023-05-17  101  		}
e994f5b677ee01 Vincent Whitchurch      2023-05-17  102  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  103  		/*
e994f5b677ee01 Vincent Whitchurch      2023-05-17  104  		 * We only use this when the device block size is the same as
e994f5b677ee01 Vincent Whitchurch      2023-05-17  105  		 * the page size, so read_start and read_end cover full pages.
e994f5b677ee01 Vincent Whitchurch      2023-05-17  106  		 *
e994f5b677ee01 Vincent Whitchurch      2023-05-17  107  		 * Compare these to the original required index and length to
e994f5b677ee01 Vincent Whitchurch      2023-05-17  108  		 * only cache pages which were requested partially, since these
e994f5b677ee01 Vincent Whitchurch      2023-05-17  109  		 * are the ones which are likely to be needed when reading
e994f5b677ee01 Vincent Whitchurch      2023-05-17  110  		 * adjacent blocks.
e994f5b677ee01 Vincent Whitchurch      2023-05-17  111  		 */
e994f5b677ee01 Vincent Whitchurch      2023-05-17  112  		if (idx == 0 && index != read_start)
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12  113) 			head_to_cache = folio;
e994f5b677ee01 Vincent Whitchurch      2023-05-17  114  		else if (idx == page_count - 1 && index + length != read_end)
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12  115) 			tail_to_cache = folio;
2e227ff5e2729b Chanho Min              2025-05-21  116  #ifdef CONFIG_SQUASHFS_COMP_CACHE_FULL
2e227ff5e2729b Chanho Min              2025-05-21  117  		/* Cache all pages in the BIO for repeated reads */
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12  118) 		else if (cache_folios)
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12  119) 			cache_folios[idx] = folio;
2e227ff5e2729b Chanho Min              2025-05-21  120  #endif
e994f5b677ee01 Vincent Whitchurch      2023-05-17  121  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  122  		if (!bio || idx != end_idx) {
e994f5b677ee01 Vincent Whitchurch      2023-05-17  123  			struct bio *new = bio_alloc_clone(bdev, fullbio,
e994f5b677ee01 Vincent Whitchurch      2023-05-17  124  							  GFP_NOIO, &fs_bio_set);
e994f5b677ee01 Vincent Whitchurch      2023-05-17  125  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  126  			if (bio) {
e994f5b677ee01 Vincent Whitchurch      2023-05-17  127  				bio_trim(bio, start_idx * PAGE_SECTORS,
e994f5b677ee01 Vincent Whitchurch      2023-05-17  128  					 (end_idx - start_idx) * PAGE_SECTORS);
e994f5b677ee01 Vincent Whitchurch      2023-05-17  129  				bio_chain(bio, new);
e994f5b677ee01 Vincent Whitchurch      2023-05-17  130  				submit_bio(bio);
e994f5b677ee01 Vincent Whitchurch      2023-05-17  131  			}
e994f5b677ee01 Vincent Whitchurch      2023-05-17  132  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  133  			bio = new;
e994f5b677ee01 Vincent Whitchurch      2023-05-17  134  			start_idx = idx;
e994f5b677ee01 Vincent Whitchurch      2023-05-17  135  		}
e994f5b677ee01 Vincent Whitchurch      2023-05-17  136  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  137  		idx++;
e994f5b677ee01 Vincent Whitchurch      2023-05-17  138  		end_idx = idx;
e994f5b677ee01 Vincent Whitchurch      2023-05-17  139  	}
e994f5b677ee01 Vincent Whitchurch      2023-05-17  140  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  141  	if (bio) {
e994f5b677ee01 Vincent Whitchurch      2023-05-17  142  		bio_trim(bio, start_idx * PAGE_SECTORS,
e994f5b677ee01 Vincent Whitchurch      2023-05-17  143  			 (end_idx - start_idx) * PAGE_SECTORS);
e994f5b677ee01 Vincent Whitchurch      2023-05-17  144  		err = submit_bio_wait(bio);
e994f5b677ee01 Vincent Whitchurch      2023-05-17  145  		bio_put(bio);
e994f5b677ee01 Vincent Whitchurch      2023-05-17  146  	}
e994f5b677ee01 Vincent Whitchurch      2023-05-17  147  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  148  	if (err)
e994f5b677ee01 Vincent Whitchurch      2023-05-17  149  		return err;
e994f5b677ee01 Vincent Whitchurch      2023-05-17  150  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  151  	if (head_to_cache) {
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12  152) 		int ret = filemap_add_folio(cache_mapping, head_to_cache,
e994f5b677ee01 Vincent Whitchurch      2023-05-17  153  						read_start >> PAGE_SHIFT,
e994f5b677ee01 Vincent Whitchurch      2023-05-17  154  						GFP_NOIO);
e994f5b677ee01 Vincent Whitchurch      2023-05-17  155  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  156  		if (!ret) {
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12  157) 			folio_mark_uptodate(head_to_cache);
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12  158) 			folio_unlock(head_to_cache);
e994f5b677ee01 Vincent Whitchurch      2023-05-17  159  		}
e994f5b677ee01 Vincent Whitchurch      2023-05-17  160  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  161  	}
e994f5b677ee01 Vincent Whitchurch      2023-05-17  162  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  163  	if (tail_to_cache) {
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12  164) 		int ret = filemap_add_folio(cache_mapping, tail_to_cache,
e994f5b677ee01 Vincent Whitchurch      2023-05-17  165  						(read_end >> PAGE_SHIFT) - 1,
e994f5b677ee01 Vincent Whitchurch      2023-05-17  166  						GFP_NOIO);
e994f5b677ee01 Vincent Whitchurch      2023-05-17  167  
e994f5b677ee01 Vincent Whitchurch      2023-05-17  168  		if (!ret) {
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12  169) 			folio_mark_uptodate(tail_to_cache);
193770db0106b0 Matthew Wilcox (Oracle  2025-06-12  170) 			folio_unlock(tail_to_cache);
e994f5b677ee01 Vincent Whitchurch      2023-05-17  171  		}
e994f5b677ee01 Vincent Whitchurch      2023-05-17  172  	}
e994f5b677ee01 Vincent Whitchurch      2023-05-17  173  

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

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

[-- Attachment #3: reproduce --]
[-- Type: text/plain, Size: 728 bytes --]

reproduce (this is a W=1 build):
        git clone https://github.com/intel/lkp-tests.git ~/lkp-tests
        git remote add akpm-mm https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git
        git fetch akpm-mm mm-everything
        git checkout akpm-mm/mm-everything
        b4 shazam https://lore.kernel.org/r/20250708142604.1891156-1-colin.i.king@gmail.com
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-8.5.0 ~/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-8.5.0 ~/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash fs/squashfs/

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

* Re: [PATCH] squashfs: Fix incorrect argument to sizeof in kmalloc_array call
  2025-07-09  1:05 ` [PATCH] squashfs: Fix incorrect argument to sizeof in kmalloc_array call kernel test robot
@ 2025-07-09  2:54   ` Andrew Morton
  2025-07-09 17:03     ` Christophe JAILLET
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2025-07-09  2:54 UTC (permalink / raw)
  To: kernel test robot
  Cc: Colin Ian King, Phillip Lougher, Chanho Min, oe-kbuild-all,
	kernel-janitors, Linux Memory Management List, linux-kernel

On Wed, 9 Jul 2025 09:05:25 +0800 kernel test robot <lkp@intel.com> wrote:

> Hi Colin,
> 
> kernel test robot noticed the following build errors:
> 
> [auto build test ERROR on akpm-mm/mm-everything]
> [also build test ERROR on next-20250708]
> [cannot apply to linus/master v6.16-rc5]
> [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/Colin-Ian-King/squashfs-Fix-incorrect-argument-to-sizeof-in-kmalloc_array-call/20250708-223017
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> patch link:    https://lore.kernel.org/r/20250708142604.1891156-1-colin.i.king%40gmail.com
> patch subject: [PATCH] squashfs: Fix incorrect argument to sizeof in kmalloc_array call
> :::::: branch date: 10 hours ago
> :::::: commit date: 10 hours ago
> config: mips-randconfig-r071-20250709 (attached as .config)
> compiler: mips64-linux-gcc (GCC) 8.5.0
> reproduce (this is a W=1 build): (attached as 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/202507090822.QI1bMiUV-lkp@intel.com/
> 
> All error/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:14,
>                     from include/linux/highmem.h:5,
>                     from include/linux/bvec.h:10,
>                     from include/linux/blk_types.h:10,
>                     from include/linux/blkdev.h:9,
>                     from fs/squashfs/block.c:16:
>    fs/squashfs/block.c: In function 'squashfs_bio_read_cached':
> >> fs/squashfs/block.c:92:12: error: 'folio' undeclared (first use in this function)
>        sizeof(*folio), GFP_KERNEL | __GFP_ZERO);
>                ^~~~~

I made it

	struct folio **cache_folios = kmalloc_array(page_count,
			sizeof(*cache_folios), GFP_KERNEL | __GFP_ZERO);



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

* Re: [PATCH] squashfs: Fix incorrect argument to sizeof in kmalloc_array call
  2025-07-09  2:54   ` Andrew Morton
@ 2025-07-09 17:03     ` Christophe JAILLET
  0 siblings, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2025-07-09 17:03 UTC (permalink / raw)
  To: Andrew Morton, kernel test robot
  Cc: Colin Ian King, Phillip Lougher, Chanho Min, oe-kbuild-all,
	kernel-janitors, Linux Memory Management List, linux-kernel

Le 09/07/2025 à 04:54, Andrew Morton a écrit :
> On Wed, 9 Jul 2025 09:05:25 +0800 kernel test robot <lkp@intel.com> wrote:
> 
>> Hi Colin,
>>
>> kernel test robot noticed the following build errors:
>>
>> [auto build test ERROR on akpm-mm/mm-everything]
>> [also build test ERROR on next-20250708]
>> [cannot apply to linus/master v6.16-rc5]
>> [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/Colin-Ian-King/squashfs-Fix-incorrect-argument-to-sizeof-in-kmalloc_array-call/20250708-223017
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
>> patch link:    https://lore.kernel.org/r/20250708142604.1891156-1-colin.i.king%40gmail.com
>> patch subject: [PATCH] squashfs: Fix incorrect argument to sizeof in kmalloc_array call
>> :::::: branch date: 10 hours ago
>> :::::: commit date: 10 hours ago
>> config: mips-randconfig-r071-20250709 (attached as .config)
>> compiler: mips64-linux-gcc (GCC) 8.5.0
>> reproduce (this is a W=1 build): (attached as 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/202507090822.QI1bMiUV-lkp@intel.com/
>>
>> All error/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:14,
>>                      from include/linux/highmem.h:5,
>>                      from include/linux/bvec.h:10,
>>                      from include/linux/blk_types.h:10,
>>                      from include/linux/blkdev.h:9,
>>                      from fs/squashfs/block.c:16:
>>     fs/squashfs/block.c: In function 'squashfs_bio_read_cached':
>>>> fs/squashfs/block.c:92:12: error: 'folio' undeclared (first use in this function)
>>         sizeof(*folio), GFP_KERNEL | __GFP_ZERO);
>>                 ^~~~~
> 
> I made it
> 
> 	struct folio **cache_folios = kmalloc_array(page_count,
> 			sizeof(*cache_folios), GFP_KERNEL | __GFP_ZERO);
> 

WHy not kcalloc(), to be less verbose and remove the explicit __GFP_ZERO?

CJ

> 
> 



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

end of thread, other threads:[~2025-07-09 17:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250708142604.1891156-1-colin.i.king@gmail.com>
2025-07-09  1:05 ` [PATCH] squashfs: Fix incorrect argument to sizeof in kmalloc_array call kernel test robot
2025-07-09  2:54   ` Andrew Morton
2025-07-09 17:03     ` Christophe JAILLET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).