summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Ian King <colin.i.king@gmail.com>2025-07-08 15:26:04 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-08-15 16:39:16 +0200
commit937385eb9064f2e6352f43afccd061b6cf4fa2cc (patch)
treeca88cc430077a30d2fb821f37fda1ad9c23a9570
parentdef563133e89fccdd07c6a88ed58f5fc92ae89c8 (diff)
squashfs: fix incorrect argument to sizeof in kmalloc_array call
[ Upstream commit 97103dcec292b8688de142f7a48bd0d46038d3f6 ] The sizeof(void *) is the incorrect argument in the kmalloc_array call, it best to fix this by using sizeof(*cache_folios) instead. Fortunately the sizes of void* and folio* happen to be the same, so this has not shown up as a run time issue. [akpm@linux-foundation.org: fix build] Link: https://lkml.kernel.org/r/20250708142604.1891156-1-colin.i.king@gmail.com Fixes: 2e227ff5e272 ("squashfs: add optional full compressed block caching") Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Cc: Phillip Lougher <phillip@squashfs.org.uk> Cc: Chanho Min <chanho.min@lge.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/squashfs/block.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index 296c5a0fcc40..e7a4649fc85c 100644
--- a/fs/squashfs/block.c
+++ b/fs/squashfs/block.c
@@ -89,7 +89,7 @@ static int squashfs_bio_read_cached(struct bio *fullbio,
int err = 0;
#ifdef CONFIG_SQUASHFS_COMP_CACHE_FULL
struct folio **cache_folios = kmalloc_array(page_count,
- sizeof(void *), GFP_KERNEL | __GFP_ZERO);
+ sizeof(*cache_folios), GFP_KERNEL | __GFP_ZERO);
#endif
bio_for_each_folio_all(fi, fullbio) {