From patchwork Mon Dec 11 10:43:24 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: 10104695 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 306DD602D8 for ; Mon, 11 Dec 2017 10:43:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 358BE2953D for ; Mon, 11 Dec 2017 10:43:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A6CC29544; Mon, 11 Dec 2017 10:43:33 +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 CABFA2953D for ; Mon, 11 Dec 2017 10:43:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752403AbdLKKnc (ORCPT ); Mon, 11 Dec 2017 05:43:32 -0500 Received: from mout.web.de ([217.72.192.78]:65019 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751347AbdLKKna (ORCPT ); Mon, 11 Dec 2017 05:43:30 -0500 Received: from [192.168.1.3] ([92.227.98.61]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0Lpw2l-1f0jJS4AdT-00fgjz; Mon, 11 Dec 2017 11:43:26 +0100 Subject: [PATCH 2/6] target: tcm_loop: Improve a size determination in two functions From: SF Markus Elfring To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, Bart Van Assche , "Nicholas A. Bellinger" Cc: LKML , kernel-janitors@vger.kernel.org References: <42f13f0c-ae1d-ec1e-fd9d-62dd15aeba8c@users.sourceforge.net> Message-ID: Date: Mon, 11 Dec 2017 11:43:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <42f13f0c-ae1d-ec1e-fd9d-62dd15aeba8c@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:lXuPVg4fxgnV35FYVbMmd764qNBsggL+tzZNiHvBGhJMi1e4GQw InnQuASOk7SVx0KXA50LHZxBuByvxU+UT29ZxalZ9cvt5vQOAr93wcEWO7shj5PQN3yHDXk duSozZSVntJBj+J8btINV2mAGt8NnqufPLd0LKo9W+9+NfLh1Hs529y67XEU9B5eFSSE5Bl wPKV0LCxhWU0nE/CjiLgw== X-UI-Out-Filterresults: notjunk:1; V01:K0:S/g9B9Rp1eI=:VmRrybaQtMX+tsaagvtyfU dYEu4F91Pix7SEZYChmODh/BJlR6/Vg8eMFcPKXOeeR1mWfP1/RYRG/R4BU+5ED7qUZ0N1pI7 KhMyt8FQZucpyQPc5bCXqnmsBGXfUk9bcaN3753bEFTxwnHSVr9NEg0UWv3LJbXPPdSNrl0Pj ZX5rElHXKCdkI1o3YFetgBU+3otsGslSpjuzhllP7vnryO+7hAb/TfOalLLMX0PADTJH+YUE9 +/vaL1fiZp01y2RbkXrCdRXglE7v3ZEtZkNowXM9u4jpnBZ50s+KDk0QlR3acun+1BQKMiANN 8ydZq6ZRbRq0mJ/wM5cRfLa9Q3vhPEzJo0Mmil751ugUE6rMgDfxWgxUFGKBBO9Vq490Pf7nA gw3HezWRuplhjJStlQrwNHoD0GkrW2Wm3cmQjG9Asq+UsPtM8jdBR58YhrbGbzWZcaNtfwVGO utZyrcy3Rfg/n7OD1iJPwy4ymapT37d1eYWKe+ZYAER4arPUOlYdsgySYrlwt3Id0Myfmu4sM gWDos35hW3jrdPGSpU3xCNznme1kO7PK01ZttIz062rWcuRXcw6zNkdo98o0ydrut6uerWEuY hMGT2JaoyAJmOVwkBt8ROlqNYjmbyYKxpsISr2T8CFLut+Bo4QMvLsq64fci++apCepZCrHbs lJeYAfiI6SCJhY03EAyApziEd62cDiJflfizdUIMJsiWjxfm5PAbV322Vi93L1SZpjWt6nMTK v59l2YPvvArwDOrH0IQUdWwMn1msPDw4SkVaec1AAoiETpFcQgX2zpQIuDgFaqJja51keKHxc 2pzDfzsQd8zxB9RjWq3bYGjLbsGePyfmh10Fh7iZ1YGPXCpiM0= 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, 10 Dec 2017 21:23:43 +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/target/loopback/tcm_loop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 6bd58a064924..60e4185e7508 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -769,7 +769,7 @@ static int tcm_loop_make_nexus( return -EEXIST; } - tl_nexus = kzalloc(sizeof(struct tcm_loop_nexus), GFP_KERNEL); + tl_nexus = kzalloc(sizeof(*tl_nexus), GFP_KERNEL); if (!tl_nexus) return -ENOMEM; @@ -1076,7 +1076,7 @@ static struct se_wwn *tcm_loop_make_scsi_hba( char *ptr; int ret, off = 0; - tl_hba = kzalloc(sizeof(struct tcm_loop_hba), GFP_KERNEL); + tl_hba = kzalloc(sizeof(*tl_hba), GFP_KERNEL); if (!tl_hba) return ERR_PTR(-ENOMEM);