Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752305AbdHSLtB (ORCPT ); Sat, 19 Aug 2017 07:49:01 -0400 Received: from mout.web.de ([212.227.15.4]:62970 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751446AbdHSLs7 (ORCPT ); Sat, 19 Aug 2017 07:48:59 -0400 Subject: [PATCH 2/2] ext4: Improve a size determination in two functions From: SF Markus Elfring To: linux-ext4@vger.kernel.org, Andreas Dilger , "Theodore Ts'o" Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Sat, 19 Aug 2017 13:48:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:6Nb7koZhD4U5npB9+uYp4TDulw3n0Tx4+k3ieUTQ8NdV9gBA7XM mBAZEc3MiRuXuTH4cUOXSE6nB+L56Go/cCJ0CxXCuwKXucGrf/si41e1j/FzcgGc5WzZG44 qqC6EasgMjViNk+62/RFQSfbNfAA1i9oky7G3PDrIDA4ihy7hZX4DfW3Wrio8CKIDfN2GUl Tc2r0SuL7GHEgz+KJvqzQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:9ymeFF7g2Rw=:fgM2Yvsfn6dhnITOMoYYGK pCLTphX4VrBsTGYTlE4pU1N5hqX2OjPzxCx8LMd0I7EiYI9DqBJAkXzJu2rh6Oj8hJ22MUAjW gK7Jf3Yev1qvnAF0NXL32FYmR/M7s9lHrZmIsL37jgwQvEJXUqdTnG6kreBHSdtnHJ8xlPvuw zfh718w56GeSuRtFE94R+vGRtAQRAqkOE1etcqoK9I2NQh4WUrzFqrdmLHgcG3uba46CUb6DE 7A/HmOWV6y76tzmu+SHPeeDnB8SKaeDrOAmGLR2a5o+GpvX5UOg3w79XGnV3hU3r8ICllLjid rIWJQU65RMDlu8QeBN8OVKQeGeXTb9AjI/vSoGp/DdWl8ETq9mUsWDJNz00PXvPVoxUAnERAw ioylSoU3vewFSmlDvWGAVw1QXCRb0oYuiY/WJMrI7fae5msJ+WYvIlgN5lvXjxf8H9CkxOXw8 ihnLtNNG2NcP/+vBUhczUlFXWz7b8/eJBMlV39O+gpmQmOgaeS31F2mnXFtbrzEhz7+Rc+Y3U 085q2ztiujqfuAf0JbQzPrAWeXQtasxxnadmmtCnizQ0nISH15XAe09zFg46KdazKsGTDK20o jMD9zsnKO68AJrgVAt5kEpcUdzGa3icPgXXuFkxiyGS+hgZZ+ZnJ8Dv8iv/fLrgIY4JU/9olo js/G+1hL+qsFgODKWAzYFwJsQ70xww0Ot5w/a8C108A7X8Ds3kQd5y1lieVtwRtHHCxQLCB1s muYM0uCq8A3M6pN9pSwym/9yVXsp5U3A78vXrqztAvAohr55FRBWAdDVSpXMa8pOse+FOSgeW ZcUAeFNwSx1xBhyYDDoISu6sGoMnff1EAvcnZntnm5bVGKWVFg= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1316 Lines: 41 From: Markus Elfring Date: Sat, 19 Aug 2017 13:14:26 +0200 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 --- fs/ext4/dir.c | 2 +- fs/ext4/mmp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index e8b365000d73..b04e882179c6 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -411,7 +411,7 @@ static struct dir_private_info *ext4_htree_create_dir_info(struct file *filp, { struct dir_private_info *p; - p = kzalloc(sizeof(struct dir_private_info), GFP_KERNEL); + p = kzalloc(sizeof(*p), GFP_KERNEL); if (!p) return NULL; p->curr_hash = pos2maj_hash(filp, pos); diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c index 1ce00453f612..3fa5df9f5573 100644 --- a/fs/ext4/mmp.c +++ b/fs/ext4/mmp.c @@ -367,5 +367,5 @@ int ext4_multi_mount_protect(struct super_block *sb, goto failed; } - mmpd_data = kmalloc(sizeof(struct mmpd_data), GFP_KERNEL); + mmpd_data = kmalloc(sizeof(*mmpd_data), GFP_KERNEL); if (!mmpd_data) -- 2.14.0