mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs/ext4: Remove unnecessary zero-initialization via memset
@ 2025-12-11 12:38 Donglin Peng
  2025-12-16  6:12 ` Baokun Li
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Donglin Peng @ 2025-12-11 12:38 UTC (permalink / raw)
  To: tytso; +Cc: adilger.kernel, linux-ext4, linux-kernel, pengdonglin

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fs/ext4: Remove unnecessary zero-initialization via memset
  2025-12-11 12:38 [PATCH] fs/ext4: Remove unnecessary zero-initialization via memset Donglin Peng
@ 2025-12-16  6:12 ` Baokun Li
  2025-12-16  7:59 ` Zhang Yi
  2026-01-28 18:04 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Baokun Li @ 2025-12-16  6:12 UTC (permalink / raw)
  To: Donglin Peng; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel, pengdonglin

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));



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fs/ext4: Remove unnecessary zero-initialization via memset
  2025-12-11 12:38 [PATCH] fs/ext4: Remove unnecessary zero-initialization via memset Donglin Peng
  2025-12-16  6:12 ` Baokun Li
@ 2025-12-16  7:59 ` Zhang Yi
  2026-01-28 18:04 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Zhang Yi @ 2025-12-16  7:59 UTC (permalink / raw)
  To: Donglin Peng; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel, pengdonglin

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));


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fs/ext4: Remove unnecessary zero-initialization via memset
  2025-12-11 12:38 [PATCH] fs/ext4: Remove unnecessary zero-initialization via memset Donglin Peng
  2025-12-16  6:12 ` Baokun Li
  2025-12-16  7:59 ` Zhang Yi
@ 2026-01-28 18:04 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2026-01-28 18:04 UTC (permalink / raw)
  To: Donglin Peng
  Cc: Theodore Ts'o, adilger.kernel, linux-ext4, linux-kernel, pengdonglin


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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-28 18:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-11 12:38 [PATCH] fs/ext4: Remove unnecessary zero-initialization via memset Donglin Peng
2025-12-16  6:12 ` Baokun Li
2025-12-16  7:59 ` Zhang Yi
2026-01-28 18:04 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®