mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] fs/squashfs/file_direct.c: replace count*size kmalloc by kcalloc
@ 2014-06-16 18:12 Fabian Frederick
  2014-06-16 18:37 ` Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2014-06-16 18:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Phillip Lougher, Andrew Morton

kcalloc manages count*sizeof overflow.

Cc: Phillip Lougher <phillip@squashfs.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/squashfs/file_direct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/squashfs/file_direct.c b/fs/squashfs/file_direct.c
index 62a0de6..e9f9cf2 100644
--- a/fs/squashfs/file_direct.c
+++ b/fs/squashfs/file_direct.c
@@ -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 = kcalloc(pages, sizeof(void *), GFP_KERNEL);
 	if (page == NULL)
 		return res;
 
-- 
1.8.4.5


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

end of thread, other threads:[~2014-06-16 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-16 18:12 [PATCH 1/1] fs/squashfs/file_direct.c: replace count*size kmalloc by kcalloc Fabian Frederick
2014-06-16 18:37 ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®