Skip to contentSkip to conversation

fs/ntfs3: Fix compilation error

PATCH In review Andy Shevchenko 1 participant 2 messages Apr 23, 2024 – Apr 24, 2024 NTFS3 filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ntfs3: Fix compilation error

Compilation with CONFIG_WERROR=y, which is default, is broken:

fs/ntfs3/super.c:1247:26: error: variable 'attr' is uninitialized when used here [-Werror,-Wuninitialized]

attr = ni_find_attr(ni, attr, NULL, ATTR_VOL_INFO, NULL, 0, NULL, NULL);

				^~~~

Pass NULL instead.

Fixes 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
---
 fs/ntfs3/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/super.c +1 -1
index 4a514931269e..fa3cc2b6d34a 100644
@@ -1244,7 +1244,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
 
 	ni = ntfs_i(inode);
 
-	attr = ni_find_attr(ni, attr, NULL, ATTR_VOL_INFO, NULL, 0, NULL, NULL);
+	attr = ni_find_attr(ni, NULL, NULL, ATTR_VOL_INFO, NULL, 0, NULL, NULL);
 	if (!attr || is_attr_ext(attr) ||
 	    !(info = resident_data_ex(attr, SIZEOF_ATTRIBUTE_VOLUME_INFO))) {
 		ntfs_err(sb, "$Volume is corrupted.");
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
#1 lore raw
Quoted 7 lines · Andy Shevchenko

Compilation with CONFIG_WERROR=y, which is default, is broken:

fs/ntfs3/super.c:1247:26: error: variable 'attr' is uninitialized when used here [-Werror,-Wuninitialized]

attr = ni_find_attr(ni, attr, NULL, ATTR_VOL_INFO, NULL, 0, NULL, NULL);

				^~~~

Pass NULL instead.

Hmm... Something weird is going on. I'm looking now into the code and have no clue why compiler is not okay with this code. The proposed patch seems incorrect anyway.

Signature · 2 lines
With Best Regards,
Andy Shevchenko