xfs: fix uninit warning in xfs_growfs_data
PATCH 1/1 xfs: fix uninit warning in xfs_growfs_data
From: Darrick J. Wong <[email protected]>
Quiet down this gcc warning:
fs/xfs/xfs_fsops.c: In function ‘xfs_growfs_data’:fs/xfs/xfs_fsops.c:219:21: error: ‘lastag_extended’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
219 | if (lastag_extended) {
| ^~~~~~~~~~~~~~~
fs/xfs/xfs_fsops.c:100:33: note: ‘lastag_extended’ was declared here
100 | bool lastag_extended;
| ^~~~~~~~~~~~~~~By setting its value explicitly. From code analysis I don't think this is a real problem, but I have better things to do than analyse this closely.
--- fs/xfs/xfs_fsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_fsops.c +1 -1
@@ -97,7 +97,7 @@ xfs_growfs_data_private(xfs_agnumber_t nagimax =0 ;xfs_rfsblock_t nb, nb_div, nb_mod;int64_t delta; -bool lastag_extended; +bool lastag_extended = false;xfs_agnumber_t oagcount;struct xfs_trans *tp;struct aghdr_init_data id = {};
Quoted 12 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Quiet down this gcc warning:
fs/xfs/xfs_fsops.c: In function ‘xfs_growfs_data’:fs/xfs/xfs_fsops.c:219:21: error: ‘lastag_extended’ may be used uninitialized in this function [-Werror=maybe-uninitialized]219 | if (lastag_extended) { | ^~~~~~~~~~~~~~~ fs/xfs/xfs_fsops.c:100:33: note: ‘lastag_extended’ was declared here 100 | bool lastag_extended; | ^~~~~~~~~~~~~~~
Quoted 3 lines
By setting its value explicitly. From code analysis I don't think this is a real problem, but I have better things to do than analyse this closely.
Huh. What compiler is complaining about that?
Quoted 10 lines
Signed-off-by Darrick J. Wong <[email protected]>--- fs/xfs/xfs_fsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/xfs_fsops.c +0
-0
fs/xfs/xfs_fsops.c xfs_growfs_data_private( · line 103
Quoted 8 lines
fs/xfs/xfs_fsops.c +1
-1@@ -97,7 +97,7 @@ xfs_growfs_data_private(xfs_agnumber_t nagimax =0 ;xfs_rfsblock_t nb, nb_div, nb_mod;int64_t delta; -bool lastag_extended; +bool lastag_extended = false;xfs_agnumber_t oagcount;struct xfs_trans *tp;struct aghdr_init_data id = {};
Looks good,
Signature · 2 lines
Dave Chinner [email protected]
Quoted 13 lines · Dave Chinner
Quoted 12 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Quiet down this gcc warning:
fs/xfs/xfs_fsops.c: In function ‘xfs_growfs_data’:fs/xfs/xfs_fsops.c:219:21: error: ‘lastag_extended’ may be used uninitialized in this function [-Werror=maybe-uninitialized]219 | if (lastag_extended) { | ^~~~~~~~~~~~~~~ fs/xfs/xfs_fsops.c:100:33: note: ‘lastag_extended’ was declared here 100 | bool lastag_extended; | ^~~~~~~~~~~~~~~
Quoted 5 lines
Quoted 3 lines
By setting its value explicitly. From code analysis I don't think this is a real problem, but I have better things to do than analyse this closely.
Huh. What compiler is complaining about that?
gcc 11.3, though oddly this only happens when I turn on gcov. Not sure what sorcery gets enabled with that, but it got in the way of teaching the fstests cloud to spit out 60MB(!) of coverage reports for each fstests run, and the source code fix seemed obvious.
Quoted 22 lines
Quoted 11 lines
Signed-off-by Darrick J. Wong <[email protected]>--- fs/xfs/xfs_fsops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/xfs_fsops.c +0
-0fs/xfs/xfs_fsops.c xfs_growfs_data_private( · line 103
Quoted 8 lines
fs/xfs/xfs_fsops.c +1
-1@@ -97,7 +97,7 @@ xfs_growfs_data_private(xfs_agnumber_t nagimax =0 ;xfs_rfsblock_t nb, nb_div, nb_mod;int64_t delta; -bool lastag_extended; +bool lastag_extended = false;xfs_agnumber_t oagcount;struct xfs_trans *tp;struct aghdr_init_data id = {};Looks good,
Quoted 1 line
Reviewed-by Dave Chinner <[email protected]>
Thanks!
--D
Quoted 2 lines
Dave Chinner
[email protected]