From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933128AbcIELes (ORCPT ); Mon, 5 Sep 2016 07:34:48 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52732 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932162AbcIELeq (ORCPT ); Mon, 5 Sep 2016 07:34:46 -0400 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: brueckner@linux.vnet.ibm.com X-IBM-RcptTo: kernel-janitors@vger.kernel.org;linux-kernel@vger.kernel.org;linux-s390@vger.kernel.org Date: Mon, 5 Sep 2016 13:34:36 +0200 From: Hendrik Brueckner To: SF Markus Elfring Cc: linux-s390@vger.kernel.org, Heiko Carstens , Hendrik =?iso-8859-1?Q?Br=FCckner?= , Martin Schwidefsky , LKML , kernel-janitors@vger.kernel.org, Julia Lawall , Paolo Bonzini Subject: Re: [PATCH] s390/cpum_cf: Use kmalloc_array() in merge_attr() References: <97bb5de4-f9c1-1e2c-cf39-3ecfee114d52@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <97bb5de4-f9c1-1e2c-cf39-3ecfee114d52@users.sourceforge.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16090511-0008-0000-0000-000002BDFB7C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16090511-0009-0000-0000-000019B0E61C Message-Id: <20160905113436.GA4502@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-05_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1609050177 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 03, 2016 at 03:27:42PM +0200, SF Markus Elfring wrote: > 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; > -- Looks good to me. Thanks. Acked-by: Hendrik Brueckner