From patchwork Wed Feb 8 21:13:29 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: 9563415 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 B4E0D601C3 for ; Wed, 8 Feb 2017 21:15:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 379FE284F3 for ; Wed, 8 Feb 2017 21:15:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2970A28511; Wed, 8 Feb 2017 21:15:05 +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 9B942284F3 for ; Wed, 8 Feb 2017 21:15:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751185AbdBHVPC (ORCPT ); Wed, 8 Feb 2017 16:15:02 -0500 Received: from mout.web.de ([212.227.15.14]:54183 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751108AbdBHVOH (ORCPT ); Wed, 8 Feb 2017 16:14:07 -0500 Received: from [192.168.1.2] ([77.181.90.255]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lcgkx-1cBLo43ZHL-00kBqO; Wed, 08 Feb 2017 22:13:32 +0100 Subject: [PATCH 03/14] RDMA/cxgb4: Use kcalloc() in two functions To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Sean Hefty , Steve Wise References: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <3050b601-fb9f-9eed-1b92-75395407a133@users.sourceforge.net> Date: Wed, 8 Feb 2017 22:13:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> X-Provags-ID: V03:K0:pGoTW3p8mksjq1z3US/tL169gXYB+J7XcDAsK8gQb6n/FwadHSA E7J9vklzYf9FSFPpUqmmMPf/Z6YTPpH1nVK6QIKPgevoefYsCvlFy0UHo+7GgoQWDbAColj ZBTvIoA7slCu/tkOSjTKXpl5PgDAWOztB3o62gqUdf22cOtpT/x6geN2THsgcUzs2zo5p46 RuwsDt4khH6rtW8Mcl04A== X-UI-Out-Filterresults: notjunk:1; V01:K0:Fx/Q5XVMEMM=:zQTOXHuElMS7UuFkLeUpBz esfm9zrgquXAVbtOy1UelkDJfzbnnQ/ZnnPfHSQwnzgX5fpWI0Qb66suWZYKS/xd4gGCnsAF7 VKUB/XVsDQ6vNeeAjmS6z7ulnDf64R2lAPaJlH3vk/3/Tiepjz9H17krGf4zvqEC5si7hmLYJ 8fSgE0QIGd+vJeD9x/b3zf39jRYn+kjHbXOQoFYBypIbm0C2Ynz2JbDDM2UhN7myrrevXvlGN l4OiS2uXVgqRJSyTk58k1m5OdnimkMXTA9lyE5tNhdCAdI9zviMJhLcGAsBxxBlbOHE0bnG+N Pr7OXIba4QpdZ7rXlm03wS+9Fml/H6TUO5DxssdQt73/OTKstYxv0vG6lbpKJchMKkfiad06E QYq33NK8eKH983mmwNpZe8s367uP+rirBWcm0tgLM4rva9yvke2FB5/L7SX5/aU/ioy2wAzt8 uo+c+JMWrZt+SoHk9BhPvgfQxciaYAv0J+k2wzvVl/qT1UEcbO/D5IjkqW4o+tNxiPlPq/K7P Uic312fOdlvpdxKjLzNNeAHAYLjRZAy0BNo2zvWxehnTrXBdqJFWJn1mF4CZ1705nmtHLWPiw jr1AgUMjOc8pVswK7DbWz9EXUBkS1DwnWqi2BFKDNL5Am9zrb2HDXi2zlmmGp+XOwduinKt21 jNGOntp5M8QVoHINNk9751qGfx37qVoHcoLkpSBEAeWkvgUWilg8vIFjdeE2Ym6R9erz3gIwi T+MSRQxgggJexN4sRuS2Th/jgG851ugT3Iss0txsGsyEZLJJ3NbJ028ft2ObNErRdiXAgyNNZ BaJRNDD 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: Wed, 8 Feb 2017 15:40:16 +0100 Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/cxgb4/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index 4e4f1a732b01..444c28206dae 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c @@ -873,7 +873,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) rdev->status_page->cq_size = rdev->lldi.vr->cq.size; if (c4iw_wr_log) { - rdev->wr_log = kzalloc((1 << c4iw_wr_log_size_order) * + rdev->wr_log = kcalloc(1 << c4iw_wr_log_size_order, sizeof(*rdev->wr_log), GFP_KERNEL); if (rdev->wr_log) { rdev->wr_log_size = 1 << c4iw_wr_log_size_order; @@ -1466,7 +1466,7 @@ static void recover_queues(struct uld_ctx *ctx) ctx->dev->db_state = RECOVERY; idr_for_each(&ctx->dev->qpidr, count_qps, &count); - qp_list.qps = kzalloc(count * sizeof *qp_list.qps, GFP_ATOMIC); + qp_list.qps = kcalloc(count, sizeof(*qp_list.qps), GFP_ATOMIC); if (!qp_list.qps) { spin_unlock_irq(&ctx->dev->lock); return;