From patchwork Wed Feb 8 21:21:38 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: 9563457 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 E3010601C3 for ; Wed, 8 Feb 2017 21:22:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B0822847B for ; Wed, 8 Feb 2017 21:22:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FE36284F9; Wed, 8 Feb 2017 21:22:07 +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 DE7F82847B for ; Wed, 8 Feb 2017 21:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752000AbdBHVVw (ORCPT ); Wed, 8 Feb 2017 16:21:52 -0500 Received: from mout.web.de ([212.227.15.14]:53143 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338AbdBHVVu (ORCPT ); Wed, 8 Feb 2017 16:21:50 -0500 Received: from [192.168.1.2] ([77.181.90.255]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Md16Y-1csgpK0HnW-00IEFk; Wed, 08 Feb 2017 22:21:40 +0100 Subject: [PATCH 11/14] RDMA/cxgb4: Use kcalloc() in create_qp() 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: <671e21d7-5962-7d2a-c359-42571a7811ba@users.sourceforge.net> Date: Wed, 8 Feb 2017 22:21:38 +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:XC0evq9Cp/StVQKILS569NM0dv/MWGN3dzh3ESMX8rMACNyjyYo tTwWjzw2Z7lFRD4fQcXjmWOqyFPjmZkWN+KAeuZxQe87cdJIKbKtAAwkSLzOPy7Jh5cewOY V/JLh5uNOtMlF6eOZCIJH+GM8PLT+02VBs4jy1Jrh/jxBVaNgUOxRx3/YK/H/m9aOVfLGoA 5xmE5FNXnrnHIqhrudNLg== X-UI-Out-Filterresults: notjunk:1; V01:K0:MvnMXqvdMP0=:CZxwORwkl0mtmbQW7c8UkZ Un5nQtMKUFY5+wff4DdhiP4+oeBb8Qv7DCyTmJXAY9hBNMHvwiatAppUIvJi8wjzzfw7LNuRX FKqzzSKGOTmxNy9+kRd/fq2CNH2NlzUyR2gMhq6q85sBU3TWjx9uSTxRlpCUkoBIlp00Pdp+q aXtyRmHrbDz/0T/Nwpf/Awbc185Pjuote7tuqqXvuaQHQbDadc9do+5mBmcCffgKVPu15HowL SKrnEWDcLioRd7a1EBcAd6KbyX9oLGBVwiye6+nxQwl0xeQ98azNDY6R36r3snvehR5ONnDSi yhvELFCZCxQrIkqKiJ2t+zDILKOcTxbN0Br3wQ2A7pN1McWy6UNy3cPfy2BnRnZc55dSdjeoZ g1u8eiIjpx45b0VQxigU16aj6NadCMPwORfguath6/uFArPHXVKemFDk6buG6ZlgBd4lWtMNa OsH8Nfs53w0nmO5ICpQD+h2QiOr5iVCLOaM+00JHAdcHhKnyZldVjvBN/Nn9xPi6UGW8EtaQN TugfsgFbgA2FpJXG2iOsPdLZF6gPpNFGt4abDYoI80cL9x81VSSW0N6gnlO9mx2Mfy5MP0w31 ZfCGWX28tUo9+KjxaNvWuBjUZZ6lZE4diDloxGlpTObcIgrxPNA1K4aICNcr11VE6JYRGzcQ/ ZP1OUxRkMm0LwnJMuJzXEXlfgno4tMwRM6j6xRiRzzTkfcdAc9ZaGZ8bA7fGsKXTi7oBRhIOK CZYEUYy0csILRvKwOB1oduj9QRQIpi3F5ttae7m34l2yBiQqk+8clqtjRsKY1NpvpXutwm8yL rFQ+KRk 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 20:27:51 +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/qp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index d4fd2f5c8326..373d66a511a8 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c @@ -216,15 +216,17 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, } if (!user) { - wq->sq.sw_sq = kzalloc(wq->sq.size * sizeof *wq->sq.sw_sq, - GFP_KERNEL); + wq->sq.sw_sq = kcalloc(wq->sq.size, + sizeof(*wq->sq.sw_sq), + GFP_KERNEL); if (!wq->sq.sw_sq) { ret = -ENOMEM; goto free_rq_qid; } - wq->rq.sw_rq = kzalloc(wq->rq.size * sizeof *wq->rq.sw_rq, - GFP_KERNEL); + wq->rq.sw_rq = kcalloc(wq->rq.size, + sizeof(*wq->rq.sw_rq), + GFP_KERNEL); if (!wq->rq.sw_rq) { ret = -ENOMEM; goto free_sw_sq;