From: kernel test robot <lkp@intel.com>
To: Colin Ian King <colin.i.king@gmail.com>,
Phillip Lougher <phillip@squashfs.org.uk>,
Chanho Min <chanho.min@lge.com>
Cc: <oe-kbuild-all@lists.linux.dev>,
<kernel-janitors@vger.kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] squashfs: Fix incorrect argument to sizeof in kmalloc_array call
Date: Wed, 9 Jul 2025 09:05:25 +0800 [thread overview]
Message-ID: <aG3AVf8fbqHzk+OD@rli9-mobl> (raw)
In-Reply-To: <20250708142604.1891156-1-colin.i.king@gmail.com>
[-- 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/
next prev parent reply other threads:[~2025-07-09 1:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 14:26 [PATCH] squashfs: Fix incorrect argument to sizeof in kmalloc_array call Colin Ian King
2025-07-08 19:05 ` Phillip Lougher
2025-07-09 1:05 ` kernel test robot [this message]
2025-07-09 2:54 ` Andrew Morton
2025-07-09 17:03 ` Christophe JAILLET
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aG3AVf8fbqHzk+OD@rli9-mobl \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=chanho.min@lge.com \
--cc=colin.i.king@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=phillip@squashfs.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.