From patchwork Fri Apr 7 21:08:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9670443 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A3E26602B3 for ; Fri, 7 Apr 2017 21:08:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96D572865D for ; Fri, 7 Apr 2017 21:08:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B6A328665; Fri, 7 Apr 2017 21:08:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47FE52865D for ; Fri, 7 Apr 2017 21:08:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756421AbdDGVIu (ORCPT ); Fri, 7 Apr 2017 17:08:50 -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 Received: from [192.168.1.2] ([77.181.117.94]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Lmu2K-1cSjPu0JQ4-00h7H1; Fri, 07 Apr 2017 23:08:22 +0200 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-Language: en-GB 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-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Sagi Grimberg --- 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;