From patchwork Sun Apr 9 19:50:12 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: 9671765 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 2406A600CB for ; Sun, 9 Apr 2017 19:50:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03E3C27D29 for ; Sun, 9 Apr 2017 19:50:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA55627F4B; Sun, 9 Apr 2017 19:50:22 +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 808CA27D29 for ; Sun, 9 Apr 2017 19:50:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752427AbdDITuV (ORCPT ); Sun, 9 Apr 2017 15:50:21 -0400 Received: from mout.web.de ([212.227.17.11]:59391 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752391AbdDITuU (ORCPT ); Sun, 9 Apr 2017 15:50:20 -0400 Received: from [192.168.1.2] ([77.181.114.244]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MPHC8-1d1gYw2uY4-004V5H; Sun, 09 Apr 2017 21:50:15 +0200 Subject: [PATCH 3/5] target: Improve size determinations in two functions From: SF Markus Elfring To: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, Bart Van Assche , "Nicholas A. Bellinger" Cc: LKML , kernel-janitors@vger.kernel.org References: <337dfdee-8a9f-9bb3-639a-ea47758966f1@users.sourceforge.net> Message-ID: <166debca-20eb-9540-5fd3-e984cc1f8098@users.sourceforge.net> Date: Sun, 9 Apr 2017 21:50:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <337dfdee-8a9f-9bb3-639a-ea47758966f1@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:h5o9ojMYLKCoJ/yqO1vUJX9X1+4duVJLzEOdeEmPEmzonGZSehI xQHXzvASz0QsZoMwVzEx1SwHA1h4r08kTeOKVGkBWzUVgB2OgTrrHLXSfiTpwxuttpeHqO1 +bu7P/CRVqo35uMRAAUI2pbT5t7vO1ZEjrlVTEzKBO/gMwqEbVIdYXYc1nNXEwm14JtyCVL xtPZAYLIZE3x/0p+R62ag== X-UI-Out-Filterresults: notjunk:1; V01:K0:M3OGs1/jG3c=:av4qtkHO4Z5M3TMp1Tk8Aw Lxm1FPdmxqlj826YBFg5lh9aBgGSgzN8HoI9bqkL+nc+bR5INep2Nljbrs0xNc6i8S7TkDMaj nli//H9qoVQDYau0YdHVFxHqluBIYbKXNWfS5smpAlf64kQqlPTclmxYS7yIX5E3nAsHffI51 IE2jbNeHSCdjYZTgyLlS/Yo9Pqc0V9/F0g2rgJha63sPn7xYAbXJJKFcMoLy3fCWr63PBKahJ 6EwJ6PAqsPdhYMQm93IMrCahYCl+v4/QZGaq0HV9IQRx+v04Yf4QRMuXbAUofRhQAn6pSRq/T 3qryTUcQOHN7ZnovypPbEzYaJ2fE5hEO1ITh22ipEBa6LlhbQDRQHlxsR1WbSItmNtdWwbYVE /18O79uS32RNABaUbaCNZ9gb0YFlHUJbvtnQPYhTMK5owEFA8wDjxAJ39abbuW3pfLDQszFyT JpALjrLsCHgDMeMbexomZiKc1rOmhoxKeH1Mqtxhsy+wc2Kx3jgeIvo140ZtOLKzUiUMg4gPe lR0OXoVQQDqsS+oaFqmzbQRDB/K73z26Fb89S2ZuWcTPID1IVGb541yoIIIpdRcBNCQ7iwd6x ymZ3Q/NZ34pEtNGCXfmdp8L17jmjD38W+ygvOGv2vcz+O2B/5ABkF1YFBtQDQIqfk95ZidUsO IcES29PlrjcckxoNLxjPo3k1rfotQK0ETJEhZkm15g4S3wiau4JuRhg3AICxzy+8S9OuM+lSs eREc+HNhp79m6yTG4omICwAih0ikgXANuy9KbJ3hIJEa4DGcxUQeBxVZQwa8HSfJPOmZn/tL1 PBLtsoG Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 9 Apr 2017 20:15:12 +0200 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 --- drivers/target/target_core_rd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index 838dc128d494..20253d04103f 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c @@ -47,7 +47,7 @@ static int rd_attach_hba(struct se_hba *hba, u32 host_id) { struct rd_host *rd_host; - rd_host = kzalloc(sizeof(struct rd_host), GFP_KERNEL); + rd_host = kzalloc(sizeof(*rd_host), GFP_KERNEL); if (!rd_host) return -ENOMEM; @@ -285,7 +285,7 @@ static struct se_device *rd_alloc_device(struct se_hba *hba, const char *name) struct rd_dev *rd_dev; struct rd_host *rd_host = hba->hba_ptr; - rd_dev = kzalloc(sizeof(struct rd_dev), GFP_KERNEL); + rd_dev = kzalloc(sizeof(*rd_dev), GFP_KERNEL); if (!rd_dev) return NULL;