The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] squashfs: Fix incorrect argument to sizeof in kmalloc_array call
@ 2025-07-08 14:26 Colin Ian King
  2025-07-08 19:05 ` Phillip Lougher
  2025-07-09  1:05 ` kernel test robot
  0 siblings, 2 replies; 5+ messages in thread
From: Colin Ian King @ 2025-07-08 14:26 UTC (permalink / raw)
  To: Phillip Lougher, Chanho Min; +Cc: kernel-janitors, Andrew Morton, linux-kernel

The sizeof(void *) is the incorrect argument in the kmalloc_array call,
it best to fix this by using sizeof(*folio) instead. Fortunately the
sizes of void * and *folio happen to be the same, so this has not shown
up as a run time issue.

Fixes: 2e227ff5e272 ("squashfs: add optional full compressed block caching")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 fs/squashfs/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index b3ae3b1cc0e5..00049b7b10c8 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(*folio), GFP_KERNEL | __GFP_ZERO);
 #endif
 
 	bio_for_each_folio_all(fi, fullbio) {
-- 
2.50.0


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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