Commit 1aa26707 authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

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: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent e424aa5f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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);