From patchwork Sat Feb 18 21:05:43 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: 9581261 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 91782604A4 for ; Sat, 18 Feb 2017 21:06:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78A4428618 for ; Sat, 18 Feb 2017 21:06:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A73E2877A; Sat, 18 Feb 2017 21:06:29 +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 219D628618 for ; Sat, 18 Feb 2017 21:06:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753828AbdBRVG1 (ORCPT ); Sat, 18 Feb 2017 16:06:27 -0500 Received: from mout.web.de ([212.227.15.3]:55693 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753585AbdBRVG0 (ORCPT ); Sat, 18 Feb 2017 16:06:26 -0500 Received: from [192.168.1.2] ([77.181.107.93]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MPowc-1ck7sx3XRS-004yqQ; Sat, 18 Feb 2017 22:05:46 +0100 Subject: [PATCH 17/29] IB/mlx4: Improve another size determination in mlx4_ib_add() 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: <2269d63f-433d-b62b-06f2-38a4d9d466f4@users.sourceforge.net> Date: Sat, 18 Feb 2017 22:05:43 +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:fD8Er6qzjPzMUm8kEw+f6uF9YnKhMxGWSprCOCYRBrI9Qw4daSW Oy7gf2TDoEabK4CegsQ5Yr0VZVkah5gt+IqYxTL4fO9JK+3MBgWjJs0QM8/KS/dHR+8+ZXy a+omzylXTA1PCGCI9PTpffdpDP4e3BJvdz6dSAj4w4kan4GsoZCUzDh0/8c2tlqAkDjurhr hP2qvMJxh6qac6WvbyD5Q== X-UI-Out-Filterresults: notjunk:1; V01:K0:gp8Y9cjhl+M=:sToNeBPg2g8P3r7311UupD q++AX7Cf0Q/GYNQ2osS1HOvA1EFiV5Z4Rg97i7eKw//n/U7e/uQyNNg3jl+FnLyRizCAu7Ygd 6yEIzsddal8lELY5Z1lE1ZeJXbHUBYsZeyXgACCwlRJsHRta7kEFT7old+i85tYyD5SD+UhZz qnHG0vrx8bFRk9CEjQ/V8AGgjPMERv85pSOx0WvwS1C5Abfzho5kgpU9rVtvJGylhvxRdVruX pQ1Jh8Jna4sKobsgkSIjweLRTMb/Upm2oo9s2ZDBBk6IjCDbu/fBmbx8TFsjeid27v7nerm9v HRBTm2UtY0HoVexI6N7MiIFBfBz/RHpa1PrnVSKsZPCgT1BwqtfmvHxugg66tweN/vGzWa3w+ CR1yIZKlHrsMvAwSrz4H/zpzbsF9agW/ZW1z91OHcNXWvtUtJOcz6tNm+1K2v0If9qcfpnHK5 T9qNXqHiY0KcRxrEMncVKgfjgXrFyvYxEg1AUCJBfg2Jv55ZclfTLpoorSnW8mJo7s1CMGrD+ sYK4OBQ00HuRlg7g8BF3hYTO+dOCpR0fEaUQvmmXW4kdKHTyMupiCHcyaTEeq/fEUHISazQpw CMVNYYr8kmA6dURdGkOxc46GWVWRjn3gruAHRyNJ2oUiOpSSZygzyWk4c5YCGgq11kOcciXW3 MPV3nbbRwR4dvBadCRHAs1luA2QqxdfRSNtY/Gx0ZSzilTKT1CPndb+bGG/YRjTPoH/v8AdSm DPpGJZswHiYqIO14obnilGo5jh8zuoItYzGz1weaka2u45tDFJdPMfVHp9pZyj55LAy4D7FLR 1gAiLoR 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 15:43:54 +0100 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring Reviewed-by: Majd Dibbiny Reviewed-by: Majd Dibbiny --- drivers/infiniband/hw/mlx4/main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index b78f17623121..f3194f2a6e62 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -2825,9 +2825,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) } if (mlx4_is_bonded(dev)) for (i = 1; i < ibdev->num_ports ; ++i) { - new_counter_index = - kmalloc(sizeof(struct counter_index), - GFP_KERNEL); + new_counter_index = kmalloc(sizeof(*new_counter_index), + GFP_KERNEL); if (!new_counter_index) goto err_counter; new_counter_index->index = counter_index;