fs/ext4/file.c | 1 - 1 file changed, 1 deletion(-)
From: pengdonglin <pengdonglin@xiaomi.com>
The d_path function does not require the caller to pre-zero the
buffer.
Signed-off-by: pengdonglin <pengdonglin@xiaomi.com>
---
fs/ext4/file.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 7a8b30932189..484cb7388802 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -858,7 +858,6 @@ static int ext4_sample_last_mounted(struct super_block *sb,
* when trying to sort through large numbers of block
* devices or filesystem images.
*/
- memset(buf, 0, sizeof(buf));
path.mnt = mnt;
path.dentry = mnt->mnt_root;
cp = d_path(&path, buf, sizeof(buf));
--
2.34.1
On Thu, 11 Dec 2025 20:38:29 +0800, Donglin Peng wrote:
> The d_path function does not require the caller to pre-zero the
> buffer.
>
>
Applied, thanks!
[1/1] fs/ext4: Remove unnecessary zero-initialization via memset
commit: 26f260ce5828fc7897a70629884916301f5825d0
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
On 12/11/2025 8:38 PM, Donglin Peng wrote: > From: pengdonglin <pengdonglin@xiaomi.com> > > The d_path function does not require the caller to pre-zero the > buffer. > > Signed-off-by: pengdonglin <pengdonglin@xiaomi.com> This should just be a cleanup. Reviewed-by: Zhang Yi <yi.zhang@huawei.com> > --- > fs/ext4/file.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/fs/ext4/file.c b/fs/ext4/file.c > index 7a8b30932189..484cb7388802 100644 > --- a/fs/ext4/file.c > +++ b/fs/ext4/file.c > @@ -858,7 +858,6 @@ static int ext4_sample_last_mounted(struct super_block *sb, > * when trying to sort through large numbers of block > * devices or filesystem images. > */ > - memset(buf, 0, sizeof(buf)); > path.mnt = mnt; > path.dentry = mnt->mnt_root; > cp = d_path(&path, buf, sizeof(buf));
On 2025-12-11 20:38, Donglin Peng wrote: > From: pengdonglin <pengdonglin@xiaomi.com> > > The d_path function does not require the caller to pre-zero the > buffer. > > Signed-off-by: pengdonglin <pengdonglin@xiaomi.com> Looks good. Feel free to add: Reviewed-by: Baokun Li <libaokun1@huawei.com> > --- > fs/ext4/file.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/fs/ext4/file.c b/fs/ext4/file.c > index 7a8b30932189..484cb7388802 100644 > --- a/fs/ext4/file.c > +++ b/fs/ext4/file.c > @@ -858,7 +858,6 @@ static int ext4_sample_last_mounted(struct super_block *sb, > * when trying to sort through large numbers of block > * devices or filesystem images. > */ > - memset(buf, 0, sizeof(buf)); > path.mnt = mnt; > path.dentry = mnt->mnt_root; > cp = d_path(&path, buf, sizeof(buf));
© 2016 - 2026 Red Hat, Inc.