From patchwork Sat Feb 18 21:13:15 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: 9581309 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 DBB7A600F6 for ; Sat, 18 Feb 2017 21:14:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC8C22849C for ; Sat, 18 Feb 2017 21:14:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C14BE2875D; Sat, 18 Feb 2017 21:14:58 +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 7855F2849C for ; Sat, 18 Feb 2017 21:14:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754155AbdBRVO3 (ORCPT ); Sat, 18 Feb 2017 16:14:29 -0500 Received: from mout.web.de ([212.227.17.11]:52212 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753343AbdBRVO0 (ORCPT ); Sat, 18 Feb 2017 16:14:26 -0500 Received: from [192.168.1.2] ([77.181.107.93]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MTPn1-1cpxnO23Ud-00SKE4; Sat, 18 Feb 2017 22:13:17 +0100 Subject: [PATCH 23/29] IB/mlx4: Improve size determinations in create_qp_common() To: linux-rdma@vger.kernel.org, Doug Ledford , Hal Rosenstock , Leon Romanovsky , Matan Barak , Sean Hefty , Yishai Hadas References: <1935365a-bd7c-461e-6a84-0c5d3a501fff@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <9b7e9f1c-ccf4-6de6-158f-cd9f86f5edb4@users.sourceforge.net> Date: Sat, 18 Feb 2017 22:13:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <1935365a-bd7c-461e-6a84-0c5d3a501fff@users.sourceforge.net> X-Provags-ID: V03:K0:uHTRGEytJ2bJ/36k/0nYFiwu2SCBQNe4og4vGsULHElmDYfQcDG G99Co955ZgYNTw6/nJ8DlyJbb8lwZxK3WFqMYPYRlJS04KHzWYhgcJFltitTCkmG0GN58oV h+fMiDXfXt7v2YzqnBPPI7SwJjxXolPJx9D0vOMYSMv9alud8qQEvGmAqIuG60cIPsehqjD h+4mxyhi9VJgt2vYr3B1Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:X1x7zK8HpOk=:usWfVWuR/kwUbIqimkNQ2W DYxHlkAt2oSSy1hRb3AlkJdLXQX7hXDduOBlwZBkXopbOPy4nBoNSOAI9yFerTk9MAIrN54wS 0EgMV+T3Q7lue3msqvnIGnY4hvBCy0cXyJqGGWBx2VehjZycwqXDqEUER/VUkB962kXmPHW/u wtiBgTb9mdUzGTzoWTyAKVrEMRAwwwODUlYdjFjzV6PFoDMUJwYUHhUh2utwhbyUQQRrazBAF XcZEE/SiZ0+ufFTEYPm/OTcYRSNwzj4w/NOL0DqnNTA04Qt/Ju0ruCc2aQfJmUBY4Vt0NcXHo 1eNnqjeNGHsQft8rTofcVxJoZzTbuGBxa/PmyWXeVK7TyVPf4zH1yMckPMkHywvRtnnuPRcC4 bXG9Kehwh2Qe2b/vq0bNOFpTO/CyiNlqqQ5AsV3dKws8ZXcZX8/AOc+UQvS8crM+cUGQAfK2e YbHfGNDD/RtEbgL3qT8wpQynAatwOOGF+9z6hZSvcL8tbnaFIH5tHMbDwXflas5FWa0yI4fRh Nfn2lOLppokGeqTR7ueooBZsphQ5C1zxJh8o4l2o8XI0hb/uaLzm9nceq5QaR1eCFqOtQH7rJ lgRHPtevZdhfFRlDv8qND9+qk6AnT9kWz/ePGF3ZEigUTFhYyN2vQHiu3kjwSx5XIoBxaldaU gEPIwMKr+2nAtGLexkNjGJZJ52iIdHL07vo8U5rQVZ29BcCSQUEtSxFv9rNLV2UzMJ9EneWiZ df6jR/dEdfcon1uoGTqfcnmR7y9/6Q0cd+CetpMKSzAfedM17nXeAaWJNdUPjOuG1A9GELyUk j2tmC3N 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: Sat, 18 Feb 2017 18:29:30 +0100 Replace the specification of two data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determinations a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring Reviewed-by: Majd Dibbiny --- drivers/infiniband/hw/mlx4/qp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 11fec4a8fae5..cc7bd257a1fd 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c @@ -691,14 +691,14 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd, if (qp_type == MLX4_IB_QPT_SMI || qp_type == MLX4_IB_QPT_GSI || (qp_type & (MLX4_IB_QPT_PROXY_SMI | MLX4_IB_QPT_PROXY_SMI_OWNER | MLX4_IB_QPT_PROXY_GSI | MLX4_IB_QPT_TUN_SMI_OWNER))) { - sqp = kzalloc(sizeof (struct mlx4_ib_sqp), gfp); + sqp = kzalloc(sizeof(*sqp), gfp); if (!sqp) return -ENOMEM; qp = &sqp->qp; qp->pri.vid = 0xFFFF; qp->alt.vid = 0xFFFF; } else { - qp = kzalloc(sizeof (struct mlx4_ib_qp), gfp); + qp = kzalloc(sizeof(*qp), gfp); if (!qp) return -ENOMEM; qp->pri.vid = 0xFFFF;