fs/pstore/ram_core.c: replace count*size kmalloc by kmalloc_array
authorFabian Frederick <fabf@skynet.be>
Fri, 8 Aug 2014 21:22:35 +0000 (14:22 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 8 Aug 2014 22:57:25 +0000 (15:57 -0700)
kmalloc_array manages count*sizeof overflow.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/pstore/ram_core.c

index 34a1e5aa848ce601f4d76911d0618f8ac6469cc3..9d7b9a83699e42c23993115d01e8ace172d46df2 100644 (file)
@@ -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);