From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: SF Markus Elfring Subject: [PATCH] s390/cpum_cf: Use kmalloc_array() in merge_attr() Message-ID: <97bb5de4-f9c1-1e2c-cf39-3ecfee114d52@users.sourceforge.net> Date: Sat, 3 Sep 2016 15:27:42 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-Archive: List-Post: To: linux-s390@vger.kernel.org, Heiko Carstens , =?UTF-8?Q?Hendrik_Br=c3=bcckner?= , Martin Schwidefsky Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall , Paolo Bonzini List-ID: From: Markus Elfring Date: Sat, 3 Sep 2016 15:17:45 +0200 * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus reuse the corresponding function "kmalloc_array". * Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- arch/s390/kernel/perf_cpum_cf_events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/kernel/perf_cpum_cf_events.c b/arch/s390/kernel/perf_cpum_cf_events.c index 4554a4b..0d6340b 100644 --- a/arch/s390/kernel/perf_cpum_cf_events.c +++ b/arch/s390/kernel/perf_cpum_cf_events.c @@ -274,7 +274,7 @@ static __init struct attribute **merge_attr(struct attribute **a, j++; j++; - new = kmalloc(sizeof(struct attribute *) * j, GFP_KERNEL); + new = kmalloc_array(j, sizeof(*new), GFP_KERNEL); if (!new) return NULL; j = 0; -- 2.9.3