From patchwork Wed Apr 5 13:51:52 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: 9664155 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 6CED1602B8 for ; Wed, 5 Apr 2017 13:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CA2E28535 for ; Wed, 5 Apr 2017 13:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5159428545; Wed, 5 Apr 2017 13:56:01 +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 33E552853E for ; Wed, 5 Apr 2017 13:56:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752932AbdDENwQ (ORCPT ); Wed, 5 Apr 2017 09:52:16 -0400 Received: from mout.web.de ([217.72.192.78]:49394 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753367AbdDENwF (ORCPT ); Wed, 5 Apr 2017 09:52:05 -0400 Received: from [192.168.1.2] ([77.182.172.209]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Lc8Xx-1cClY73Qt3-00jaxN; Wed, 05 Apr 2017 15:51:55 +0200 Subject: [PATCH 1/5] IB/qib: Use kcalloc() in qib_init_iba7322_funcs() 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: <5e5e00d3-b6a4-7371-65be-c5fe387d26b3@users.sourceforge.net> Date: Wed, 5 Apr 2017 15:51:52 +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:9/oHJXhAnJC+7kE6IREhpcMRibbIRkp8P9QZM502OJ6FMtA8xwS BV8fMGB9NFgh8BnepuwGbfCMnewmgDEr161E9DMnEChagAY9arM6B13Lgz0G67PPe8PoRh3 BBXDzfQiMMK+s8jZBjvFPqpwNExqFbr+pcisub6oII//lQH5mkk3VLH2bmA4oQw/0ncDURC V9AVW5J33Vhaiofs7t8SQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:J188nzaM7fU=:WUiyZfOM9bfQ7yVWjNJuW2 Zr62voko7d0xsLkqp9hYHcnHeiSBThNvinXWV6mrWoiUfuhkRPCQsolB7l6IDxvYHjRff7g1/ bUUEhyEdGK0fhUD0cxhbTqIYXN3j+Woa/J+svrKsR8dpj0HOe8GQ8FLiy7Xfyfuqx+nddpGzo qyYCy2bVAUfZk2XXUiZbhN86UHWod2BdxxiBqN4ZgjLXkhD3H11DMgvlxEfKB9rWF22IsW8pO 3B5Fgl5AQRdpGbovmbw2GKtTQJl7bMEC/x5LQciXx6N4JRdCUhvLljHhxbhZdHE5eg6DWOsUl zqc+XavpnLC7N4o8EJC3GOW07KDKgGgxsvLHbwlZG1g2eEcIleZpckv6TIZhTQ9V99ohb8VCJ hbWBLkz1HJsumjUu/+46xEfH0V394DSaB+l+r91PCtuqJvOg6L4OxZylMTIV8Rd9cIi0aBSQv n0LNUQ+Yf87tJYQGJwcMeiUsKiKOy8CII0VEyszYjIBdKqPj2d7Z4VE/UuKzLFUZLbcn6yLgt 4c9n9NWQxAg+s0XCVzCF01muhcfgiCivHjcY6dy4xbT3wtOGEQdH3IGbfis5n/yCEZH0d6cXN J2PHN82bylGrh2mnGXlsXBezYBk9xeFhUBLvvJyWSkAn0iCzYQ6hjhgzAbkjPCGNi1EIGqrRU j5W2V1UwatlTGmVc7Op1TQcSYtkPY6PLmcraNMpbX8zkfK/4MIwRDLKCcj2UBczxXnHvn6Nil Or4TiylzDb7nKPV9b4Y6DMVtR23I/JoiCnGXXWV6lRjH/2zRCGUGFIF+G7DqzpSv237ckun2w pvJ6zOx 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 09:43:54 +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. * 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 --- drivers/infiniband/hw/qib/qib_iba7322.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index af9f596bb68b..e4e4e675c89c 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c @@ -7324,8 +7324,9 @@ struct qib_devdata *qib_init_iba7322_funcs(struct pci_dev *pdev, actual_cnt -= dd->num_pports; tabsize = actual_cnt; - dd->cspec->msix_entries = kzalloc(tabsize * - sizeof(struct qib_msix_entry), GFP_KERNEL); + dd->cspec->msix_entries = kcalloc(tabsize, + sizeof(*dd->cspec->msix_entries), + GFP_KERNEL); if (!dd->cspec->msix_entries) tabsize = 0;