Commit 18c16f60 authored by Nirjhar Roy (IBM)'s avatar Nirjhar Roy (IBM) Committed by Carlos Maiolino
Browse files

xfs: Replace ASSERT with XFS_IS_CORRUPT in xfs_rtcopy_summary()



Replace ASSERT(sum > 0) with an XFS_IS_CORRUPT() and place it just
after the call to xfs_rtget_summary() so that we don't end up using
an illegal value of sum.

Signed-off-by: default avatarNirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
Reviewed-by: default avatarCarlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarCarlos Maiolino <cem@kernel.org>
parent 6de23f81
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -112,6 +112,10 @@ xfs_rtcopy_summary(
			error = xfs_rtget_summary(oargs, log, bbno, &sum);
			if (error)
				goto out;
			if (XFS_IS_CORRUPT(oargs->mp, sum < 0)) {
				error = -EFSCORRUPTED;
				goto out;
			}
			if (sum == 0)
				continue;
			error = xfs_rtmodify_summary(oargs, log, bbno, -sum);
@@ -120,7 +124,6 @@ xfs_rtcopy_summary(
			error = xfs_rtmodify_summary(nargs, log, bbno, sum);
			if (error)
				goto out;
			ASSERT(sum > 0);
		}
	}
	error = 0;