diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-03-22 09:51:51 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-03-25 16:47:49 -0700 |
commit | 1aa26707ebd65e1260f4a912cae1fb4c37cc4ebd (patch) | |
tree | 506834debac44eb4611e16a53d806f431a5f9d33 | |
parent | e424aa5f547d2510f8ea1199e7b4ed8ef2d9439d (diff) | |
download | linux-1aa26707ebd65e1260f4a912cae1fb4c37cc4ebd.tar.bz2 |
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
-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); |