Unverified Commit ca1ceddf authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Konstantin Komarov
Browse files

ntfs3: Restore NULL folio initialization in ntfs_writepages()



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: 099ef9ab ("fs/ntfs3: implement iomap-based file operations")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/oe-kbuild-all/202601010644.FIhOXy6Y-lkp@intel.com/
Closes: https://lore.kernel.org/r/202601010513.axd56bks-lkp@intel.com/


Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
[almaz.alexandrovich@paragon-software.com: added a few more tags]
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
parent 6b3c83df
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);