Message ID | 8c9488b0-4d91-48ac-bee7-6454e3045a9f@web.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | hugetlbfs: Adjustments for two function implementations | expand |
> On Dec 29, 2023, at 19:37, Markus Elfring <Markus.Elfring@web.de> wrote: > > From: Markus Elfring <elfring@users.sourceforge.net> > Date: Fri, 29 Dec 2023 11:32:07 +0100 > > 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> Reviewed-by: Muchun Song <songmuchun@bytedance.com> Thanks.
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ea5b8e57d904..24401a5046dd 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1460,7 +1460,7 @@ hugetlbfs_fill_super(struct super_block *sb, struct fs_context *fc) struct hugetlbfs_fs_context *ctx = fc->fs_private; struct hugetlbfs_sb_info *sbinfo; - sbinfo = kmalloc(sizeof(struct hugetlbfs_sb_info), GFP_KERNEL); + sbinfo = kmalloc(sizeof(*sbinfo), GFP_KERNEL); if (!sbinfo) return -ENOMEM; sb->s_fs_info = sbinfo; @@ -1530,7 +1530,7 @@ static int hugetlbfs_init_fs_context(struct fs_context *fc) { struct hugetlbfs_fs_context *ctx; - ctx = kzalloc(sizeof(struct hugetlbfs_fs_context), GFP_KERNEL); + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM;