2019-12-06 05:45:18

by Chengguang Xu

[permalink] [raw]
Subject: [PATCH] ext4: remove unnecessary assignment in ext4_htree_store_dirent()

We have allocated memory using kzalloc() so don't have
to set 0 again in last byte.

Signed-off-by: Chengguang Xu <[email protected]>
---
fs/ext4/dir.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index 9fdd2b269d61..5923c9147ae7 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -458,7 +458,6 @@ int ext4_htree_store_dirent(struct file *dir_file, __u32 hash,
new_fn->name_len = ent_name->len;
new_fn->file_type = dirent->file_type;
memcpy(new_fn->name, ent_name->name, ent_name->len);
- new_fn->name[ent_name->len] = 0;

while (*p) {
parent = *p;
--
2.20.1




2020-01-13 18:53:27

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] ext4: remove unnecessary assignment in ext4_htree_store_dirent()

On Fri, Dec 06, 2019 at 01:43:17PM +0800, Chengguang Xu wrote:
> We have allocated memory using kzalloc() so don't have
> to set 0 again in last byte.
>
> Signed-off-by: Chengguang Xu <[email protected]>

Thanks, applied.

- Ted