Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755726AbdDEOfJ (ORCPT ); Wed, 5 Apr 2017 10:35:09 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:26906 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755694AbdDEOe7 (ORCPT ); Wed, 5 Apr 2017 10:34:59 -0400 Date: Wed, 5 Apr 2017 17:34:39 +0300 From: Yuval Shaia To: SF Markus Elfring Cc: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Mike Marciniszyn , Sean Hefty , LKML , kernel-janitors@vger.kernel.org Subject: Re: [PATCH 1/5] IB/qib: Use kcalloc() in qib_init_iba7322_funcs() Message-ID: <20170405143438.GC5006@yuval-lap> References: <5e5e00d3-b6a4-7371-65be-c5fe387d26b3@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5e5e00d3-b6a4-7371-65be-c5fe387d26b3@users.sourceforge.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1718 Lines: 45 On Wed, Apr 05, 2017 at 03:51:52PM +0200, SF Markus Elfring wrote: > From: Markus Elfring > Date: Wed, 5 Apr 2017 09:43:54 +0200 > > * A multiplication for the size determination of a memory allocation > indicated that an array data structure should be processed. > Thus use the corresponding function "kcalloc". > > This issue was detected by using the Coccinelle software. > > * Replace the specification of a data structure 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 > --- > drivers/infiniband/hw/qib/qib_iba7322.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c > index af9f596bb68b..e4e4e675c89c 100644 > --- a/drivers/infiniband/hw/qib/qib_iba7322.c > +++ b/drivers/infiniband/hw/qib/qib_iba7322.c > @@ -7324,8 +7324,9 @@ struct qib_devdata *qib_init_iba7322_funcs(struct pci_dev *pdev, > actual_cnt -= dd->num_pports; > > tabsize = actual_cnt; > - dd->cspec->msix_entries = kzalloc(tabsize * > - sizeof(struct qib_msix_entry), GFP_KERNEL); > + dd->cspec->msix_entries = kcalloc(tabsize, > + sizeof(*dd->cspec->msix_entries), > + GFP_KERNEL); Are we fine with loosing the zeroing of the entries? > if (!dd->cspec->msix_entries) > tabsize = 0; > > -- > 2.12.2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html