From patchwork Wed Feb 8 21:11:40 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: 9563421 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 3B4676020F for ; Wed, 8 Feb 2017 21:15:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEADB284F3 for ; Wed, 8 Feb 2017 21:15:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2EE02851A; Wed, 8 Feb 2017 21:15:38 +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 283B2284F9 for ; Wed, 8 Feb 2017 21:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751991AbdBHVPg (ORCPT ); Wed, 8 Feb 2017 16:15:36 -0500 Received: from mout.web.de ([212.227.17.12]:61987 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750972AbdBHVOG (ORCPT ); Wed, 8 Feb 2017 16:14:06 -0500 Received: from [192.168.1.2] ([77.181.90.255]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MSJGB-1cz2df2Kk7-00TVEN; Wed, 08 Feb 2017 22:11:44 +0100 Subject: [PATCH 01/14] RDMA/cxgb3: Use kcalloc() in cxio_create_qp() To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Sean Hefty , Steve Wise References: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: Date: Wed, 8 Feb 2017 22:11:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <0aff92fa-2891-333a-2e1e-ca309db2ec72@users.sourceforge.net> X-Provags-ID: V03:K0:cVs0cUc7p3VbRMc9EqhDifxwyDaVz47lvbzZA/yBK9RABB2pEpd LJQMppZbyEg870whhD1UUujpAJGDJ+lxJiEALxGIGU9dNB5PqOjrA1NPNhUycCeUmLhekCL pHjCVS+Rb0thH1/WafeA6kngLnNWAfBo+SZ1zOafufOuVM1ipD3G19w++ZYbDp0jocvCrRm qroaXxEdvQr2iBNFsq3oQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Bn4Z4x5BAU8=:IuwwqGqGQ1C6W27IRuxoTx iV3xTysigJ6JLI7jRzuuRXFFBFenUk5XX24IJaKXYkPhpxhCffpot3ZW8xKMs9OPf/Ju1fLHu NWwRgBxC/3MaIQSmn9/1QjsVFXuL3Fo+4PoKWdcCZMGvunw/CWacj5fR5h/HiFzmNkKYjKZWf p00I0EY1bqoPu4ERaI4W8QevDUrnuB1W67MJSYzh43Pb1NVmlQ5I5nIamYsDDbKg7Rw6UwvG7 ajbdX7QWIyppedIz0FvSBGhlWxT5xe5vESZT6sNFYhoRbKbPYYOuP5zxwr6cV487Bt1nnh4pw 8GuRXpYtRLKOivGe6bZvQMLVqiSAHJI4GeCjvcTyqUcD9BwkikR94smCLHwgIUOlHS8BSABwX sKtFKF4vbM3gA62xS3/uz0SPFDhAUmT4+E/WUjKAsUldVbN/QXCuo60rC0L3ZO/no7f51ZpJh 2e9rPIASGL1t2K1jwIU+Uas/zicfhgSXsclulA9UjqBoIqTPcxISD09FGlSqS05jiArSpa73W lZydmq49d1GoVlmVntO2uRN+O1kCc8kSq2uib+jCxXw0blXhZcWU0hB+L7adXthYiDooOL2nN XnKjCu82Vzz7qayNyMpShh9saIl8IGK05m9noOF/v4I9E/Ji1q3wG5LT7o0diaAWO0ZlIiw3P CMRXM9QolQedpOGTM21FVVKHyrzUApDomuyhRYOkoA90Kx5VtgWkvVRTnO6N4D1IJ9xm6LAg4 Qk5NRWGca+3SX5j6tfKBJCz/5NqVsKfaQQamKidDD7D9yNkTKUGAw0+/Ji84ZZRLBHSO7gPZS i85CNSM 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, 8 Feb 2017 11:37:13 +0100 * Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of data structures by pointer dereferences to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/infiniband/hw/cxgb3/cxio_hal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c index ada2e5009c86..aeb1dfa8bfe5 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.c +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c @@ -281,7 +281,7 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain, if (!wq->qpid) return -ENOMEM; - wq->rq = kzalloc(depth * sizeof(struct t3_swrq), GFP_KERNEL); + wq->rq = kcalloc(depth, sizeof(*wq->rq), GFP_KERNEL); if (!wq->rq) goto err1; @@ -289,7 +289,7 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain, if (!wq->rq_addr) goto err2; - wq->sq = kzalloc(depth * sizeof(struct t3_swsq), GFP_KERNEL); + wq->sq = kcalloc(depth, sizeof(*wq->sq), GFP_KERNEL); if (!wq->sq) goto err3;