Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932708AbdDENyi (ORCPT ); Wed, 5 Apr 2017 09:54:38 -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 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-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1100 Lines: 31 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; } -- 2.12.2