ntfs3: avoid -Wmaybe-uninitialized warning
PATCH 1/1 ntfs3: avoid -Wmaybe-uninitialized warning
From: Arnd Bergmann <[email protected]>
This warning shows up with gcc-10 now:
In file included from fs/ntfs3/index.c:15:fs/ntfs3/index.c: In function 'indx_add_allocate':fs/ntfs3/ntfs_fs.h:463:9: error: 'bmp_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
463 | return attr_set_size_ex(ni, type, name, name_len, run, new_size,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
464 | new_valid, keep_prealloc, NULL, false);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/ntfs3/index.c:1498:6: note: 'bmp_size' was declared here
1498 | u64 bmp_size, bmp_size_v;
| ^~~~~~~~The warning does look correct, as the 'out2' label can be reached without initializing bmp_size and bmp_size_v. Initialize these at the same place as bmp.
---
Note that this is one is separate from the one I reported with KCSAN
--- fs/ntfs3/index.c | 1 + 1 file changed, 1 insertion(+)
fs/ntfs3/index.c +1 -0
@@ -1506,6 +1506,7 @@ static int indx_add_allocate(struct ntfs_index *indx, struct ntfs_inode *ni,if (bit !=MINUS_ONE_T ) { bmp =NULL ; + bmp_size = bmp_size_v =0 ; }else {if (bmp->non_res) { bmp_size =le64_to_cpu (bmp->nres.data_size);
Signature · 1 line
2.39.5
Konstantin Komarov
maintainerQuoted 31 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
This warning shows up with gcc-10 now:
In file included from
fs/ntfs3/index.c:15:fs/ntfs3/index.c: In function 'indx_add_allocate':fs/ntfs3/ntfs_fs.h:463:9: error: 'bmp_size' may be used uninitialized in this function [-Werror=maybe-uninitialized]463 | return attr_set_size_ex(ni, type, name, name_len, run, new_size, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 464 | new_valid, keep_prealloc, NULL, false); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ntfs3/index.c:1498:6: note: 'bmp_size' was declared here 1498 | u64 bmp_size, bmp_size_v; | ^~~~~~~~The warning does look correct, as the 'out2' label can be reached without initializing
bmp_sizeandbmp_size_v. Initialize these at the same place as bmp.Signed-off-by Arnd Bergmann <[email protected]>---
Note that this is one is separate from the one I reported with KCSAN--- fs/ntfs3/index.c | 1 + 1 file changed, 1 insertion(+)fs/ntfs3/index.c +0
-0
fs/ntfs3/index.c static int indx_add_allocate(struct ntfs_index *indx, struct ntfs_inode *ni, · line 1512
Quoted 7 lines
fs/ntfs3/index.c +1
-0@@ -1506,6 +1506,7 @@ static int indx_add_allocate(struct ntfs_index *indx, struct ntfs_inode *ni,if (bit !=MINUS_ONE_T ) { bmp =NULL ; + bmp_size = bmp_size_v =0 ; }else {if (bmp->non_res) { bmp_size =le64_to_cpu (bmp->nres.data_size);
Hello,
Sorry for the delay.
Your patch is applied, thank you.
Regards,
Konstantin