mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] btrfs: initialize folios to NULL in compress_file_range()
@ 2025-10-19  8:36 Kriish Sharma
  2025-10-19  9:12 ` Qu Wenruo
  0 siblings, 1 reply; 2+ messages in thread
From: Kriish Sharma @ 2025-10-19  8:36 UTC (permalink / raw)
  To: clm, dsterba
  Cc: linux-btrfs, linux-kernel, skhan, david.hunter.linux,
	Kriish Sharma, kernel test robot

The variable 'folios' may be used uninitialized when jumping to cleanup
labels, triggering the following clang warning:

  fs/btrfs/inode.c:874:6: warning: variable 'folios' is used uninitialized
  whenever 'if' condition is true

Initialize 'folios' to NULL to ensure the cleanup path is safe and to
silence the compiler warning.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202510171743.VQ6yA0Uu-lkp@intel.com/
Signed-off-by: Kriish Sharma <kriish.sharma2006@gmail.com>
---
 fs/btrfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d726bcdacf6b..54903e17338f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -862,7 +862,7 @@ static void compress_file_range(struct btrfs_work *work)
 	u64 actual_end;
 	u64 i_size;
 	int ret = 0;
-	struct folio **folios;
+	struct folio **folios = NULL;
 	unsigned long nr_folios;
 	unsigned long total_compressed = 0;
 	unsigned long total_in = 0;
-- 
2.34.1


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

* Re: [PATCH] btrfs: initialize folios to NULL in compress_file_range()
  2025-10-19  8:36 [PATCH] btrfs: initialize folios to NULL in compress_file_range() Kriish Sharma
@ 2025-10-19  9:12 ` Qu Wenruo
  0 siblings, 0 replies; 2+ messages in thread
From: Qu Wenruo @ 2025-10-19  9:12 UTC (permalink / raw)
  To: Kriish Sharma, clm, dsterba
  Cc: linux-btrfs, linux-kernel, skhan, david.hunter.linux, kernel test robot



在 2025/10/19 19:06, Kriish Sharma 写道:
> The variable 'folios' may be used uninitialized when jumping to cleanup
> labels, triggering the following clang warning:
> 
>    fs/btrfs/inode.c:874:6: warning: variable 'folios' is used uninitialized
>    whenever 'if' condition is true
> 
> Initialize 'folios' to NULL to ensure the cleanup path is safe and to
> silence the compiler warning.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202510171743.VQ6yA0Uu-lkp@intel.com/
> Signed-off-by: Kriish Sharma <kriish.sharma2006@gmail.com>

Before the LKP report it's already fixed in the for-next branch.

> ---
>   fs/btrfs/inode.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index d726bcdacf6b..54903e17338f 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -862,7 +862,7 @@ static void compress_file_range(struct btrfs_work *work)
>   	u64 actual_end;
>   	u64 i_size;
>   	int ret = 0;
> -	struct folio **folios;
> +	struct folio **folios = NULL;
>   	unsigned long nr_folios;
>   	unsigned long total_compressed = 0;
>   	unsigned long total_in = 0;


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

end of thread, other threads:[~2025-10-19  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-19  8:36 [PATCH] btrfs: initialize folios to NULL in compress_file_range() Kriish Sharma
2025-10-19  9:12 ` Qu Wenruo

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®