Skip to content

Commit

Permalink
fs/squashfs/file_direct.c: replace count*size kmalloc by kmalloc_array
Browse files Browse the repository at this point in the history
kmalloc_array() manages count*sizeof overflow.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Phillip Lougher <phillip@squashfs.org.uk>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Fabian Frederick authored and torvalds committed Aug 7, 2014
1 parent e04aca4 commit 1469488
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/squashfs/file_direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 1469488

Please sign in to comment.