linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-ext4@vger.kernel.org,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Theodore Ts'o <tytso@mit.edu>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2] ext4: Improve a size determination in two functions
Date: Sat, 19 Aug 2017 13:48:55 +0200	[thread overview]
Message-ID: <c1941b22-bdab-fccf-06e2-2f9fc50daec1@users.sourceforge.net> (raw)
In-Reply-To: <ca49a6dc-f2ee-d427-5f16-052706277b38@users.sourceforge.net>

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

  parent reply	other threads:[~2017-08-19 11:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-19 11:46 [PATCH 0/2] fs-ext4: Adjustments for two function implementations SF Markus Elfring
2017-08-19 11:47 ` [PATCH 1/2] ext4: Delete an error message for a failed memory allocation in ext4_multi_mount_protect() SF Markus Elfring
2017-08-19 17:08   ` Eric Sandeen
2017-08-19 18:00     ` SF Markus Elfring
2017-08-24 17:44       ` Theodore Ts'o
2017-08-24 19:16     ` [PATCH 1/2] " Dan Carpenter
2017-08-19 11:48 ` SF Markus Elfring [this message]
2017-08-20  1:49   ` [PATCH 2/2] ext4: Improve a size determination in two functions Eric Sandeen
2017-08-24 17:50     ` Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c1941b22-bdab-fccf-06e2-2f9fc50daec1@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=adilger.kernel@dilger.ca \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).