From patchwork Wed Mar 8 12:36:53 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: 9611013 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 6E52160414 for ; Wed, 8 Mar 2017 12:56:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 541B928582 for ; Wed, 8 Mar 2017 12:56:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45AE128587; Wed, 8 Mar 2017 12:56:02 +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 2ABDE2857D for ; Wed, 8 Mar 2017 12:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751720AbdCHMzm (ORCPT ); Wed, 8 Mar 2017 07:55:42 -0500 Received: from mout.web.de ([212.227.15.3]:54241 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753196AbdCHMzl (ORCPT ); Wed, 8 Mar 2017 07:55:41 -0500 Received: from [192.168.1.2] ([92.228.144.238]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LmuQW-1c4XJz152K-00h6Rk; Wed, 08 Mar 2017 13:36:55 +0100 Subject: [PATCH 01/26] IB/ocrdma: Use kcalloc() in ocrdma_create_eqs() To: linux-rdma@vger.kernel.org, Devesh Sharma , Doug Ledford , Hal Rosenstock , Sean Hefty , Selvin Xavier References: Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Wed, 8 Mar 2017 13:36:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:6CHMw4lriA1zVcw0Pm3n/tFOybvqPLtn0C8XzfGSwWxp96OY9DA jGgSpStDiGL+hyj9lcFQdZyzoYn9K/Wed2exK7LZbD5supgjybwLyqt7WntP6n1fMnaBlXV aEuRgFw2ZQ4wJqC6qCPodpWaCzvfXzrhJvqh9Lv6D14QUiheCL2cssw/HrUzkuZ9Q3jcG9k bwUn/fkYFxypvFKIQRN4Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:XWop1QMbYKE=:I3mTCyFjTvoP//8j64mMGd qKHZTNf1vw2ommHSRZhjTz5ruIE2RRlwfeUyYV6Z2V2U05T/vP/Yub4pTndKZaHFjQL/kos9E 1/j0lBmbDYpF0H8hpl3Xccf7JzCt3xC4+t2OECjVolmphur7Nikxzk8CerzcsC2kWxd5Ehlvs wtGt+lGRB0rGJdrR9I+O2Cod4J3IjNrEYDtzYHEARW7sxbi0/uJRrcxYRIC/BHkEv4b12nAq3 j+mAnGWep1FOv075ho6qCMIX756zjegrIH4bMVuF36PNgNVv7jnjda92ENTlOCLOAOaknr1NH T0dSIgmMBQZaLL3S2MLpGivf9V1TR0Svbok66PU2hZYCEw0gSsET/JsB8lUQj9M1tgzJvt7fF 4JXZlnZ/Zoa8pFTotkKhUxPmLYvS1fLdeA+11/TPCQqZo5pYn+u07aMIL5Asb3xd02OMsXxRD VAXadIG6wEbKZ+33pMD2cVToKbnNJZ4gskxqlfHNOuRPSJj5jddXlwsc6CEW5TiWIYI6XRnn7 iPUDcdsDqOrT0m3hWwffPSnT2volsc1UlPeXxsmIsSabyocRW1lMICUQd3TEHrmyUxpesRGIS IzNIua3vigq0zh1Ku4gk5fFYnuuA1n+r4dwCt+k1nMBeuKzNKcAKna8IZk74s1TgOj+cB5LAo JAkENZglrsCPz9b7qVlhiYHWl3H9BovI7ZmuyjgdQmkfcz9DOWUsOqJjkgbSmHgFwMlDCweTQ ZfnwPqYJzlhRWFE9UEf2tfOU2C0Ae/okKQ8AEyVZ3RQoEOsxRk4NBTcmPAuNX3BW2+tpeCH0k r139ooP 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: Tue, 7 Mar 2017 17:56:45 +0100 * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus reuse 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/ocrdma/ocrdma_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index aa6967197620..cbac41b15d94 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c @@ -3103,7 +3103,7 @@ static int ocrdma_create_eqs(struct ocrdma_dev *dev) if (!num_eq) return -EINVAL; - dev->eq_tbl = kzalloc(sizeof(struct ocrdma_eq) * num_eq, GFP_KERNEL); + dev->eq_tbl = kcalloc(num_eq, sizeof(*dev->eq_tbl), GFP_KERNEL); if (!dev->eq_tbl) return -ENOMEM;