From patchwork Sat Nov 4 13:17:45 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: 10041581 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 9026360384 for ; Sat, 4 Nov 2017 13:18:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80FA6294FB for ; Sat, 4 Nov 2017 13:18:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 757A52967E; Sat, 4 Nov 2017 13:18:02 +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=unavailable 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 371DB295F4 for ; Sat, 4 Nov 2017 13:18:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932258AbdKDNRt (ORCPT ); Sat, 4 Nov 2017 09:17:49 -0400 Received: from mout.web.de ([217.72.192.78]:57224 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752500AbdKDNRs (ORCPT ); Sat, 4 Nov 2017 09:17:48 -0400 Received: from [192.168.1.3] ([92.226.117.170]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MQNeK-1dhIM20syC-00Tjtt; Sat, 04 Nov 2017 14:17:46 +0100 Subject: [PATCH 3/4] target: Improve a size determination in three functions From: SF Markus Elfring To: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, "Nicholas A. Bellinger" Cc: LKML , kernel-janitors@vger.kernel.org References: <27e27d42-473d-e8db-fe9e-803fed646881@users.sourceforge.net> Message-ID: Date: Sat, 4 Nov 2017 14:17:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <27e27d42-473d-e8db-fe9e-803fed646881@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:9J5aSSMhMy3HrhHmH6TGCus8KnIvZDDdzssPc+11ffrJIdYrFKl dH3UptAdnai3P7gh7MZXrbUP1lxXoodKxnYHPYYqS8IPkW6RIupN5no4o14LVFqldSHWvuR 09ieEyJdv0zLMcTbf/4AE7g7YjxGSHu+/5up59wyd+XAkjPCoyCcvW3bnDprlYQaelaTGAr VOH7LSEr5Ab36y0FiwMrg== X-UI-Out-Filterresults: notjunk:1; V01:K0:4ChPG1gE5TU=:x0j563hzVQcztXnRZIS+Eo SBMUYmIeQxhT/f3H2tS8b7S8dM4Ebp5Y4EVAhbomkIn4xB1QYriiW3F8I3dFRPRESBg3yPEzm it2HZRQNnX8XM6LiSQWAAScqzbyrZw2NNSU8Sw+JGeZ3Trw2udicWDmlyhZMFhE1sZL0uq0Q8 48B92svSOM1tQBWmARWIQBr5CjHbtUaIVwUmuJxR2z+g8tTgXGhXJkybcGx4OG99hHvygLWOa +2Q3tjZClS83w/tkzdWk2LQ8+gt0hFfWBkrPJA84//DOgIu466isT6sOVdEqau5+PpxJ+Hg6u ojjiHINz+pJcDXAh6dtKlkOI7aZEgTpKdPi5nf3jUmxOVlw2/nxJGzcSP2X2WVuRIqZD4a24v XCcmT2kTeNgloXcJRmIpzjlup6VPe0Dh/gbRBkOWoz2SCLaGXh5GxI9tyU7XvucOI0SHKMYhh oZfueG2thQlHWDw6wGew8bG5Xh8vLLtMXvjcrGEXVKSmrBC16XSLjamdmPkKKpjPAahbRN+vG ZJnarS1CGWmzFyFEYRKCem/BfMKj+euVVbCQoGXJrTocxDwIdHTYHrm2/7RIC7pw0SQW4l+dm tLWY7ePfxuYGvHKq7FQKz8NVmu8lZVJzGE6+wQqCSKCFaMTW9ueFo09GabkeXsEjxiS94i49d /ecfQYJZZwCedanCHd8HsFKVSEbqEDTaujbRaEhrut+yIOBIGpcHE7nY63yP+TK36Z6HA6Cpe fkES3DSJIOUljiRseZqnIRgHkv8XAH6xm4gxoSp37fHh+diEVY5kyOi/v9A5HPTZ5sD1e/Rvh 5OJOvq5GUSUJwsBpmOOO8HBD58zGuR8qZv8UctTqdmqcqe6o0g= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 4 Nov 2017 13:35:08 +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/target_core_xcopy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index 46cac36014df..1519e399392b 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c @@ -680,7 +680,7 @@ static int target_xcopy_read_source( unsigned char cdb[16]; bool remote_port = (xop->op_origin == XCOL_DEST_RECV_OP); - xpt_cmd = kzalloc(sizeof(struct xcopy_pt_cmd), GFP_KERNEL); + xpt_cmd = kzalloc(sizeof(*xpt_cmd), GFP_KERNEL); if (!xpt_cmd) { pr_err("Unable to allocate xcopy_pt_cmd\n"); return -ENOMEM; @@ -742,7 +742,7 @@ static int target_xcopy_write_destination( unsigned char cdb[16]; bool remote_port = (xop->op_origin == XCOL_SOURCE_RECV_OP); - xpt_cmd = kzalloc(sizeof(struct xcopy_pt_cmd), GFP_KERNEL); + xpt_cmd = kzalloc(sizeof(*xpt_cmd), GFP_KERNEL); if (!xpt_cmd) { pr_err("Unable to allocate xcopy_pt_cmd\n"); return -ENOMEM; @@ -1010,7 +1010,7 @@ sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) return TCM_PARAMETER_LIST_LENGTH_ERROR; } - xop = kzalloc(sizeof(struct xcopy_op), GFP_KERNEL); + xop = kzalloc(sizeof(*xop), GFP_KERNEL); if (!xop) goto err; xop->xop_se_cmd = se_cmd;