From: Markus Elfring Date: Thu, 24 Aug 2017 17:50:24 +0000 (-0400) Subject: ext4: use sizeof(*ptr) X-Git-Tag: v4.14-rc1~134^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d695a1bea351276615ad270860bc1fbddcfbaeb3;p=platform%2Fkernel%2Flinux-exynos.git ext4: use sizeof(*ptr) 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 Signed-off-by: Theodore Ts'o Reviewed-by: Eric Sandeen --- diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index e8b3650..b04e882 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 eb98356..77cdce1 100644 --- a/fs/ext4/mmp.c +++ b/fs/ext4/mmp.c @@ -367,7 +367,7 @@ skip: goto failed; } - mmpd_data = kmalloc(sizeof(struct mmpd_data), GFP_KERNEL); + mmpd_data = kmalloc(sizeof(*mmpd_data), GFP_KERNEL); if (!mmpd_data) { ext4_warning(sb, "not enough memory for mmpd_data"); goto failed;