fs/ext4/hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sizeof(char) evaluates to 1. Remove the churn.
Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
---
Changes in v2:
- change back to kzalloc because sizeof(char) is 1. Nice catch. Thanks.
- Link to v1: https://lore.kernel.org/r/20250315-ext4-hash-kcalloc-v1-1-a9132cb49276@ethancedwards.com
---
fs/ext4/hash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/hash.c b/fs/ext4/hash.c
index deabe29da7fbc3d35f674ff861a2f3b579ffdea2..33cd5b6b02d59fb749844fe481022f5f44244bb6 100644
--- a/fs/ext4/hash.c
+++ b/fs/ext4/hash.c
@@ -302,7 +302,7 @@ int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
if (len && IS_CASEFOLDED(dir) &&
(!IS_ENCRYPTED(dir) || fscrypt_has_encryption_key(dir))) {
- buff = kzalloc(sizeof(char) * PATH_MAX, GFP_KERNEL);
+ buff = kzalloc(PATH_MAX, GFP_KERNEL);
if (!buff)
return -ENOMEM;
---
base-commit: da920b7df701770e006928053672147075587fb2
change-id: 20250315-ext4-hash-kcalloc-203033977bd9
Best regards,
--
Ethan Carter Edwards <ethan@ethancedwards.com>
On Sun, 16 Mar 2025 01:33:59 -0400, Ethan Carter Edwards wrote:
> sizeof(char) evaluates to 1. Remove the churn.
>
>
Applied, thanks!
[1/1] ext4: hash: simplify kzalloc(n * 1, ...) to kzalloc(n, ...)
commit: 1e93d6f221e7cfe5e069583a2b664e79eb361ba6
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
On Mar 15, 2025, at 11:33 PM, Ethan Carter Edwards <ethan@ethancedwards.com> wrote:
>
> sizeof(char) evaluates to 1. Remove the churn.
>
> Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com>
Thanks,
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
> ---
> Changes in v2:
> - change back to kzalloc because sizeof(char) is 1. Nice catch. Thanks.
> - Link to v1: https://lore.kernel.org/r/20250315-ext4-hash-kcalloc-v1-1-a9132cb49276@ethancedwards.com
> ---
> fs/ext4/hash.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/hash.c b/fs/ext4/hash.c
> index deabe29da7fbc3d35f674ff861a2f3b579ffdea2..33cd5b6b02d59fb749844fe481022f5f44244bb6 100644
> --- a/fs/ext4/hash.c
> +++ b/fs/ext4/hash.c
> @@ -302,7 +302,7 @@ int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
>
> if (len && IS_CASEFOLDED(dir) &&
> (!IS_ENCRYPTED(dir) || fscrypt_has_encryption_key(dir))) {
> - buff = kzalloc(sizeof(char) * PATH_MAX, GFP_KERNEL);
> + buff = kzalloc(PATH_MAX, GFP_KERNEL);
> if (!buff)
> return -ENOMEM;
>
>
> ---
> base-commit: da920b7df701770e006928053672147075587fb2
> change-id: 20250315-ext4-hash-kcalloc-203033977bd9
>
> Best regards,
> --
> Ethan Carter Edwards <ethan@ethancedwards.com>
>
Cheers, Andreas
© 2016 - 2025 Red Hat, Inc.