From 630bbfecf8441285d9de3fe1b5c4bec4c71e71a0 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 8 Apr 2015 09:44:19 +1000 Subject: [PATCH] mm-mempool-do-not-allow-atomic-resizing-checkpatch-fixes WARNING: Prefer kmalloc_array over kmalloc with multiply #111: FILE: mm/mempool.c:149: + new_elements = kmalloc(new_min_nr * sizeof(*new_elements), GFP_KERNEL); total: 0 errors, 1 warnings, 81 lines checked ./patches/mm-mempool-do-not-allow-atomic-resizing.patch has style problems, please review. If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Please run checkpatch prior to sending patches Cc: David Rientjes Signed-off-by: Andrew Morton --- mm/mempool.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/mempool.c b/mm/mempool.c index 9bbffa54c9c324..949970db287415 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -146,7 +146,8 @@ int mempool_resize(mempool_t *pool, int new_min_nr) spin_unlock_irqrestore(&pool->lock, flags); /* Grow the pool */ - new_elements = kmalloc(new_min_nr * sizeof(*new_elements), GFP_KERNEL); + new_elements = kmalloc_array(new_min_nr, sizeof(*new_elements), + GFP_KERNEL); if (!new_elements) return -ENOMEM;