diff options
| author | Ethan Carter Edwards <ethan@ethancedwards.com> | 2024-12-23 05:23:56 +0300 |
|---|---|---|
| committer | Gao Xiang <hsiangkao@linux.alibaba.com> | 2025-01-16 22:17:20 +0300 |
| commit | a78c5c2269e39544fab4140105f55fca4502e915 (patch) | |
| tree | 1fcc749d3427d444605338f8a62e2385b2d4edc9 | |
| parent | 5bc55a333a2f7316b58edc7573e8e893f7acb532 (diff) | |
| download | linux-a78c5c2269e39544fab4140105f55fca4502e915.tar.xz | |
fs: erofs: xattr.c change kzalloc to kcalloc
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@ethancedwards.com>
Link: https://lore.kernel.org/r/i3CLJhMELKzBJr3DaRyv-hP_4m-3Twx0sgBWXW6naZlMtHrIeWr93xOFshX8qZHDrJeSjHMTiUOh8JmBZ9v0AB-S1lIYM_d-vasSRlsF_s4=@ethancedwards.com
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
| -rw-r--r-- | fs/erofs/xattr.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) if (!sbi->xattr_prefix_count) return 0; - pfs = kzalloc(sbi->xattr_prefix_count * sizeof(*pfs), GFP_KERNEL); + pfs = kcalloc(sbi->xattr_prefix_count, sizeof(*pfs), GFP_KERNEL); if (!pfs) return -ENOMEM; |
