[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8c9488b0-4d91-48ac-bee7-6454e3045a9f@web.de>
Date: Fri, 29 Dec 2023 12:37:48 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-mm@...ck.org, kernel-janitors@...r.kernel.org,
Muchun Song <muchun.song@...ux.dev>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] hugetlbfs: Improve a size determination in two functions
From: Markus Elfring <elfring@...rs.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@...rs.sourceforge.net>
---
fs/hugetlbfs/inode.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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;
--
2.43.0
Powered by blists - more mailing lists