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