From patchwork Sat Jan 27 21:21:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10187653 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 5435D602C8 for ; Sat, 27 Jan 2018 21:21:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F19F2835B for ; Sat, 27 Jan 2018 21:21:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D85D28B6D; Sat, 27 Jan 2018 21:21:49 +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 C3C6C2835B for ; Sat, 27 Jan 2018 21:21:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752687AbeA0VVr (ORCPT ); Sat, 27 Jan 2018 16:21:47 -0500 Received: from mout.web.de ([217.72.192.78]:59489 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752439AbeA0VVq (ORCPT ); Sat, 27 Jan 2018 16:21:46 -0500 Received: from [192.168.1.2] ([78.49.117.84]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MX0YK-1eIMCQ2BxE-00W0Do; Sat, 27 Jan 2018 22:21:34 +0100 Subject: [PATCH 3/3] RDMA/iwpm: Improve a size determination in two functions From: SF Markus Elfring To: linux-rdma@vger.kernel.org, Chien Tin Tung , Doug Ledford , Geert Uytterhoeven , Jason Gunthorpe , Johannes Berg , Leon Romanovsky , Shiraz Saleem , Tatyana Nikolova Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Sat, 27 Jan 2018 22:21:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:vNr9uUDZF1hkiFoROjFFUPw5oWUZ0JBycBRA8U314e/yC9aGhky Ms4XkwXcQdX3UzxtQmf4YyS42O6xWvmGMEc8khZcGx7ygw5QFLyIopERufdBYq6Bw7+juVN rGTlLQ9fJqRlrZVnabAorzXlvA+Ih7sL/G7BJbBbUsxS1JVgBEjIcT9DIoBjDjflwhpCro2 HOnaznZ81qsXRdXul4DKA== X-UI-Out-Filterresults: notjunk:1; V01:K0:57vt+CXg2Qs=:wQgtiW0PWg7x+pMlJyKm+W q4Jk/gdh2537TAjJt71JqM+VwBEEKkRYmjLdN8cJ2snA9Kbsp9U4eghd004zbxGLvu7VJ2xzL TZl0eBt7wHGNF+0t0YxPmdWlchmBIkyfhb+qbaMIr+Vm8m7cb+ixtrprzumdVy6Ir2pfGgZru 6Gj75ClmWkWRTyXeiPRA/slzxcxgN+hlgi64S1vHTr5VPdngK5i1CSOLacTWmgw6r2u/h5Xbo 1y0oOBjpXK5ODbCoPlA1J3Y2XE76BaEYpVyR9sKaDZRP1s9YJitH0+g4lp/f9hcTU1np3wbvR UQURqXHua5CRvyPoO9K/J5urxx/Qe1PfC/peYBkEm0Lx32uuP+Sf7UxagEvbbgHZmDIvhvCY/ +6PaI8uM44KAH0iFtJfE/rvutiRDOvA9cGUtma+8Sis7wPEyFqNKCp9hbIFTjdzwNzIVDzOrH DatAx001V0aOyD7Jzs851ouN9eR+63ByrtRg9oPsBNNGQYTurrXDSa0zyhijUt+AKFtR1tsSW 2L+Z2QyFHZZ9tZhSapL2z7Fydim7ce7YqGLpZocYQ5I4mvFtoCzC33QQCObbvnYCLwlFjlSxk p8NfbzEQqrxtNSIQaPWAGwcvaz8VU8VcQg4c9ulkH/umFfB/AM1/k+qN+ppPoJjKfGsio5knz ph5LoJSgXn+bxOFT8yi4K2BlpSCGIyHfFqHHwTHEKCrUasryMIoUTNxyOObp2bRIzZr3Pmi6M q63i+aJN+vsD0kJIiDvbPj2Va739cckLFctx62BFqjhM2hlw5aD1OOAtg1ZvxMazTyNqPna8i +idfqmm5eWrtTuSlzuR2SVupOzAMk+o2v3OMOdP+GAjF/3iHZQ= 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, 27 Jan 2018 22:05:54 +0100 Replace the specification of data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/infiniband/core/iwpm_util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c index 9eb527074c32..902a2677df31 100644 --- a/drivers/infiniband/core/iwpm_util.c +++ b/drivers/infiniband/core/iwpm_util.c @@ -121,7 +121,8 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr, if (!iwpm_valid_client(nl_client)) return ret; - map_info = kzalloc(sizeof(struct iwpm_mapping_info), GFP_KERNEL); + + map_info = kzalloc(sizeof(*map_info), GFP_KERNEL); if (!map_info) return -ENOMEM; @@ -298,7 +299,7 @@ struct iwpm_nlmsg_request *iwpm_get_nlmsg_request(__u32 nlmsg_seq, struct iwpm_nlmsg_request *nlmsg_request = NULL; unsigned long flags; - nlmsg_request = kzalloc(sizeof(struct iwpm_nlmsg_request), gfp); + nlmsg_request = kzalloc(sizeof(*nlmsg_request), gfp); if (!nlmsg_request) return NULL;