Skip to contentSkip to conversation

fs/squashfs/file_direct.c: replace count*size kmalloc by kmalloc_array

PATCH New Fabian Frederick 1 participant 1 message Jun 16, 2014 SquashFS file system

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fs/squashfs/file_direct.c: replace count*size kmalloc by kmalloc_array

kmalloc_array manages count*sizeof overflow.

Cc Phillip Lougher <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Joe Perches <[email protected]>

---
V2:
use kmalloc_array instead of kcalloc (suggested by Joe Perches).

 fs/squashfs/file_direct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/squashfs/file_direct.c +1 -1
index 62a0de6..43e7a7e 100644
@@ -44,7 +44,7 @@ int squashfs_readpage_block(struct page *target_page, u64 block, int bsize)
 
 	pages = end_index - start_index + 1;
 
-	page = kmalloc(sizeof(void *) * pages, GFP_KERNEL);
+	page = kmalloc_array(pages, sizeof(void *), GFP_KERNEL);
 	if (page == NULL)
 		return res;
 
Signature · 1 line
1.8.4.5