Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752612AbdHTBtX (ORCPT ); Sat, 19 Aug 2017 21:49:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34358 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752440AbdHTBtW (ORCPT ); Sat, 19 Aug 2017 21:49:22 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D342C7E43D Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=esandeen@redhat.com Reply-To: sandeen@redhat.com Subject: Re: [PATCH 2/2] ext4: Improve a size determination in two functions To: SF Markus Elfring , linux-ext4@vger.kernel.org, Andreas Dilger , "Theodore Ts'o" Cc: LKML , kernel-janitors@vger.kernel.org References: From: Eric Sandeen Message-ID: <0d7fe1c1-f1f4-3c2f-0e2a-4c8545947714@redhat.com> Date: Sat, 19 Aug 2017 20:49:20 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; 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-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 20 Aug 2017 01:49:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1493 Lines: 46 On 8/19/17 6:48 AM, SF Markus Elfring wrote: > 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 Looks good, Reviewed-by: Eric Sandeen > --- > 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) >