diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-10-29 00:48:58 +0200 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-10-31 16:58:20 +0100 |
commit | b65e08f83b119ae9345ed23d4da357a72b3cb55c (patch) | |
tree | 5c25440a24f3ed77d51f8401412b939e20f6a8fb /fs/xfs/scrub/ialloc.c | |
parent | xfs: make sure aglen never goes negative in xfs_refcount_adjust_extents (diff) | |
download | linux-b65e08f83b119ae9345ed23d4da357a72b3cb55c.tar.xz linux-b65e08f83b119ae9345ed23d4da357a72b3cb55c.zip |
xfs: create a predicate to verify per-AG extents
Create a predicate function to verify that a given agbno/blockcount pair
fit entirely within a single allocation group and don't suffer
mathematical overflows. Refactor the existng open-coded logic; we're
going to add more calls to this function in the next patch.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/scrub/ialloc.c')
-rw-r--r-- | fs/xfs/scrub/ialloc.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/xfs/scrub/ialloc.c b/fs/xfs/scrub/ialloc.c index e1026e07bf94..e312be7cd375 100644 --- a/fs/xfs/scrub/ialloc.c +++ b/fs/xfs/scrub/ialloc.c @@ -108,9 +108,8 @@ xchk_iallocbt_chunk( xfs_agblock_t bno; bno = XFS_AGINO_TO_AGBNO(mp, agino); - if (bno + len <= bno || - !xfs_verify_agbno(pag, bno) || - !xfs_verify_agbno(pag, bno + len - 1)) + + if (!xfs_verify_agbext(pag, bno, len)) xchk_btree_set_corrupt(bs->sc, bs->cur, 0); xchk_iallocbt_chunk_xref(bs->sc, irec, agino, bno, len); |