[PATCH] ntfs3: Restore NULL folio initialization in ntfs_writepages()

From: Nathan Chancellor
Date: Mon Jan 05 2026 - 14:23:28 EST


Clang warns (or errors with CONFIG_WERROR=y):

fs/ntfs3/inode.c:1021:6: error: variable 'folio' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
1021 | if (is_resident(ni)) {
| ^~~~~~~~~~~~~~~
fs/ntfs3/inode.c:1024:48: note: uninitialized use occurs here
1024 | while ((folio = writeback_iter(mapping, wbc, folio, &err)))
| ^~~~~

folio should be initialized to NULL for the first iteration of
writeback_iter() to start the loop properly. Restore the NULL
initialization of folio that was lost in the recent iomap conversion to
clear up the warning.

Fixes: 099ef9ab9203 ("fs/ntfs3: implement iomap-based file operations")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202601010644.FIhOXy6Y-lkp@xxxxxxxxx/
Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
---
fs/ntfs3/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index b969ad7c3258..438d468f28ba 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -1019,7 +1019,7 @@ static int ntfs_writepages(struct address_space *mapping,
return -EIO;

if (is_resident(ni)) {
- struct folio *folio;
+ struct folio *folio = NULL;

while ((folio = writeback_iter(mapping, wbc, folio, &err)))
err = ntfs_resident_writepage(folio, wbc);

---
base-commit: 099ef9ab9203dff327f2d61e44773f9acbc01f13
change-id: 20260105-ntfs3-restore-null-folio-init-e3d7a7d6dd01

Best regards,
--
Nathan Chancellor <nathan@xxxxxxxxxx>