Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715644

[PATCH 2/2] ext4: Improve a size determination in two functions

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/2] ext4: Improve a size determination in two functions
Date Sat, 19 Aug 2017 13:50:01 +0200
Message-ID <ugaql-NZ-1@gated-at.bofh.it> (permalink)
References <ugaql-NZ-3@gated-at.bofh.it>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
MIME-Version 1.0
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 robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 41
Organization linux.* mail to news gateway
X-Original-Cc LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
X-Original-Date Sat, 19 Aug 2017 13:48:55 +0200
X-Original-Message-ID <c1941b22-bdab-fccf-06e2-2f9fc50daec1@users.sourceforge.net>
X-Original-References <ca49a6dc-f2ee-d427-5f16-052706277b38@users.sourceforge.net>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1715644

Show key headers only | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] ext4: Improve a size determination in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-19 13:50 +0200
  Re: [PATCH 2/2] ext4: Improve a size determination in two functions Eric Sandeen <esandeen@redhat.com> - 2017-08-20 03:50 +0200
    Re: [PATCH 2/2] ext4: Improve a size determination in two functions Theodore Ts'o <tytso@mit.edu> - 2017-08-24 20:00 +0200

csiph-web