Commit b8f52d89 authored by Fabian Frederick's avatar Fabian Frederick Committed by Linus Torvalds

fs/pstore/ram_core.c: replace count*size kmalloc by kmalloc_array

kmalloc_array manages count*sizeof overflow.
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 340f365d
...@@ -394,7 +394,7 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size) ...@@ -394,7 +394,7 @@ static void *persistent_ram_vmap(phys_addr_t start, size_t size)
prot = pgprot_noncached(PAGE_KERNEL); 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) { if (!pages) {
pr_err("%s: Failed to allocate array for %u pages\n", pr_err("%s: Failed to allocate array for %u pages\n",
__func__, page_count); __func__, page_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment