Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933015AbdDGVI4 (ORCPT ); Fri, 7 Apr 2017 17:08:56 -0400 Received: from mout.web.de ([217.72.192.78]:53981 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754935AbdDGVIs (ORCPT ); Fri, 7 Apr 2017 17:08:48 -0400 Subject: [PATCH 8/9] IB/isert: Use kcalloc() in isert_alloc_rx_descriptors() From: SF Markus Elfring To: linux-rdma@vger.kernel.org, target-devel@vger.kernel.org, David Ahern , Doug Ledford , Erez Shitrit , Feras Daoud , Hal Rosenstock , Leon Romanovsky , Mark Bloch , Or Gerlitz , Paolo Abeni , Roi Dayan , Sagi Grimberg , Sean Hefty , Yuval Shaia , Zhu Yanjun Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Fri, 7 Apr 2017 23:08:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:RAFfdNIG5y2xNPn1eJr0eyWTWHvIvktmCbhcsxk+gH/NvS4lyJp b07+EffABANuzjhl3uHL4TyCKzikVVXv+yqE8DB+sroK96t/0Z5UL6TVJwNxzLYBKYyM7tw cjPkF6YwOjIZX8iVO/YVi/uCt57qjOm9bdt0EvARNoIp+ROIpjXRz6Z9gAQCI3wone9ugqA AGWapbF5IvuERXmNoOc5A== X-UI-Out-Filterresults: notjunk:1;V01:K0:nENj5hv3Snw=:RTuY+NaBNItppjP4hHTeY7 KznrOOgpuMVhsTbVWt2vQQ8l8L/msOAzJsazkJZWu3LAID9iSrkx2yXOy5HdhY0+7AuYWCgLI Lu7DKQTlh0XiVIZK1kN4CHS+gaLl/4ru/RVOKwpW3sFE01hgfkzwuMeJrkk4QppRtUyy5rNUw cr63lgZycOpJ4oS9qMniJHKbCdnksI4TcixTwqCvL8+N0O9xUUTfJZb0BYA1Ezrc45/G2/H/I A9Fcc/oCDEb43SOtDrmgGan7ZjrSGI/woUJiaauW/gNBWbhFoIDi7u+heY+7pcCn+ws8RpBnk +xZ65cylKHjs3IEoNaaza+yAGi0Sp1LkFl1ZXn88a6iTTuP6CFAQzWlR9L3P76Jbh1D+/1/Rb WZKN3U0JxFPFGwJOj9OzEXCTy8bGvT4vG0zCfT7b5j+IRUfi828k7xS9bMJnDM2/WZjIzfXxE 28zFbT40rbT5EeXGbbgxeznMInI8Xnx+aow2tds4yAfTiyr8A4oNPoC3/JWLSNHeNbWGqtlTM qUdbJ1BFkyaacALpd5ztEJkIrwhxuT+Y8ZkhuvVWLF2yzTmGrLj2vDUtJ2qdWQeASsKLDEEpe aFcg078KJjVSJw80u3tfNLJpHe0kzSZkByIBfN1e9wI+4HphRHMkVzTFP29Oc4a2jcOAx4kjx NcRPqizi1sIA0hmDeRM/KENZzxh7VLQ4zkoevPlLEslo/j0y5Sf81oSWc+1YHw4/HtOoIYRyC kYri7KNVE3OBAGgpQ9GlGhQpZalhAZ6ie5O/rUfnTf1StJGhkiONGRXWTgbz8XOwf+9HErw+d sA658K7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1248 Lines: 34 From: Markus Elfring Date: Fri, 7 Apr 2017 22:00:43 +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". * 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/ulp/isert/ib_isert.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 91cbe86b25c8..c56af6183082 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c @@ -181,8 +181,9 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn) u64 dma_addr; int i, j; - isert_conn->rx_descs = kzalloc(ISERT_QP_MAX_RECV_DTOS * - sizeof(struct iser_rx_desc), GFP_KERNEL); + isert_conn->rx_descs = kcalloc(ISERT_QP_MAX_RECV_DTOS, + sizeof(*isert_conn->rx_descs), + GFP_KERNEL); if (!isert_conn->rx_descs) return -ENOMEM; -- 2.12.2