diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-01-22 16:48:45 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-01-31 17:58:16 -0800 |
commit | 4a5cfea66b2676313362bf689bb7cb84baa4af4b (patch) | |
tree | 46687f4170e36d5533d348b1f6147c3fa947c26c /fs/xfs/scrub | |
parent | e049dc86ca68d281d919c318e2489e2d131959ce (diff) |
xfs: fix uninitialized variables in xrep_calc_ag_resblks
If we can't read the AGF header, we never actually set a value for
freelen and usedlen. These two variables are used to make the worst
case estimate of btree size, so it's safe to set them to the AG size as
a fallback.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub')
-rw-r--r-- | fs/xfs/scrub/repair.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c index 25e86c71e7b9..61bc43418a2a 100644 --- a/fs/xfs/scrub/repair.c +++ b/fs/xfs/scrub/repair.c @@ -207,7 +207,11 @@ xrep_calc_ag_resblks( /* Now grab the block counters from the AGF. */ error = xfs_alloc_read_agf(mp, NULL, sm->sm_agno, 0, &bp); - if (!error) { + if (error) { + aglen = xfs_ag_block_count(mp, sm->sm_agno); + freelen = aglen; + usedlen = aglen; + } else { struct xfs_agf *agf = bp->b_addr; aglen = be32_to_cpu(agf->agf_length); |