From patchwork Wed Apr 5 13:53:47 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: 9664145 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 4B276602B8 for ; Wed, 5 Apr 2017 13:55:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A7EB28535 for ; Wed, 5 Apr 2017 13:55:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DC2B28545; Wed, 5 Apr 2017 13:55:11 +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 CF35628535 for ; Wed, 5 Apr 2017 13:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932327AbdDENyT (ORCPT ); Wed, 5 Apr 2017 09:54:19 -0400 Received: from mout.web.de ([212.227.17.11]:52282 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753497AbdDENyO (ORCPT ); Wed, 5 Apr 2017 09:54:14 -0400 Received: from [192.168.1.2] ([77.182.172.209]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MK20H-1cuw240KZx-001UvX; Wed, 05 Apr 2017 15:53:49 +0200 Subject: [PATCH 3/5] IB/qib: Use kcalloc() in qib_alloc_devdata() From: SF Markus Elfring To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Mike Marciniszyn , Sean Hefty Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <9bcddc18-197c-0784-bb25-8ac6446d8fb6@users.sourceforge.net> Date: Wed, 5 Apr 2017 15:53:47 +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:/ZFhBI/eKa40DpcZQQZgTi2i5pyS5l4xnOlpbxQUzK0HrbJEyG0 YCJ0lA051yoQUFfoprm9eR0jDyR8LML/uRzuhukAzBHGQytlk0IFvBw1h1fEb+nnI8/E3m8 ndu0o2jt9Iuh8mLdDe12fan0vAOmeHSthSouYkxSUDScrGMvTAQ64oO00yrqWHtcxFs58kb y/eE+iIyrUvEtkMW3JtWQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:iiZZ3nkH8bg=:DjtRbgf51INdXKy15mVHpO NCC29afH1CQ8KgCS3bxAo4EneMXYBQiMthw+uB1kSQ1r+F6ZytwVZQIFIi2k5mREwxBKC3F/c K++uodBmfMViAmHp6OE+4GTYrwRFnbCSujEN4LgLKLpRUhiu9ZRl/kadTN3f+c33MQ699m8at OoJNJ+E3Eaf39CLBKf7mYDmStQZMRTxiCuzVFz+yRYuPDN3xlrU8Rt48cpGC94ansSLkg9dCk MnXRQ18OHaDM6VPxluIsw6AdWXqIz3n7cusOt2g2J0RjtKpIUs536wo1vs0kefGzfR4NYYQ+g VXR901N2Jda8gs+aQUCMtuJ5JKuBTXsz3iZrE0z9C8ib0x6eGn8Ky043ZQJQlizX4Ypg+PWTq 4BV4fLIISh3ukmSANtAz0dVXDO4BaOcFVLMIjZwLDJqf7w5snToOcP4tT4h1Alol1NMUWPtI5 dZ9TxMdFJzlSHiCFBu9FuHrNqA2QeLl+n86orRq+oaSPVr4OoIVCc9/LamhJa+3jJMGg24pwx Jr8Q3rMA8hXUOTEjI6ROoIDjsqmz4zZAxfZc+7gJxCtzhlInZxiYXCkAlebTsjOb8kpoKnUob ywno700qEqbNhulNnlHh+Tj4/ksZ9i0/fQH/gHEtWfCyQlr9U0s4pCJNeuzJrEKFyU+Raz4tA +ZVs0x2oQQLB3wN1B+f+Ata4nF016aYmnTK/5SUkIcvbtyjMRhoFiAVJ72wlTRfo7JFdKe9NJ a3MsvbolCYZ7NGTLy7ZMsYa5LSYr1aFu9+Ip6IreDevVm2fAziOqyuUq1BZVCDoGnIrmvk19C KxvlR7C 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, 5 Apr 2017 14:15:45 +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. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/qib/qib_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c index b50240b1d5a4..9e680ca971e3 100644 --- a/drivers/infiniband/hw/qib/qib_init.c +++ b/drivers/infiniband/hw/qib/qib_init.c @@ -1140,8 +1140,8 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra) if (!qib_cpulist_count) { u32 count = num_online_cpus(); - qib_cpulist = kzalloc(BITS_TO_LONGS(count) * - sizeof(long), GFP_KERNEL); + qib_cpulist = kcalloc(BITS_TO_LONGS(count), sizeof(long), + GFP_KERNEL); if (qib_cpulist) qib_cpulist_count = count; }