Skip to content

Commit

Permalink
fs/pstore/ram_core.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 <[email protected]>
Cc: Anton Vorontsov <[email protected]>
Cc: Colin Cross <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Fabian Frederick authored and torvalds committed Aug 8, 2014
1 parent 340f365 commit b8f52d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/pstore/ram_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size)

prot = pgprot_noncached(PAGE_KERNEL);

pages = kmalloc(sizeof(struct page *) * page_count, GFP_KERNEL);
pages = kmalloc_array(page_count, sizeof(struct page *), GFP_KERNEL);
if (!pages) {
pr_err("%s: Failed to allocate array for %u pages\n",
__func__, page_count);
Expand Down

0 comments on commit b8f52d8

Please sign in to comment.