[PATCH] fs: erofs: xattr.c change kzalloc to kcalloc
From: Ethan Carter Edwards
Date: Sun Dec 22 2024 - 21:23:56 EST
Refactor xattr.c to use kcalloc instead of kzalloc when multiplying
allocation size by count. This refactor prevents unintentional
memory overflows. Discovered by checkpatch.pl.
Signed-off-by: Ethan Carter Edwards <ethan@xxxxxxxxxxxxxxxxx>
---
fs/erofs/xattr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/erofs/xattr.c b/fs/erofs/xattr.c
index a90d7d649739..7940241d9355 100644
--- a/fs/erofs/xattr.c
+++ b/fs/erofs/xattr.c
@@ -478,7 +478,7 @@ int erofs_xattr_prefixes_init(struct super_block *sb)
=09if (!sbi->xattr_prefix_count)
=09=09return 0;
=20
-=09pfs =3D kzalloc(sbi->xattr_prefix_count * sizeof(*pfs), GFP_KERNEL);
+=09pfs =3D kcalloc(sbi->xattr_prefix_count, sizeof(*pfs), GFP_KERNEL);
=09if (!pfs)
=09=09return -ENOMEM;
=20
--=20
2.47.1