Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: fix off-by-one error in rtbitmap cross-reference

Fix an off-by-one error in the realtime bitmap "is used" cross-reference
helper function if the realtime extent size is a single block.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>

+2 -3
+2 -3
fs/xfs/scrub/rtbitmap.c
··· 141 141 startext = fsbno; 142 142 endext = fsbno + len - 1; 143 143 do_div(startext, sc->mp->m_sb.sb_rextsize); 144 - if (do_div(endext, sc->mp->m_sb.sb_rextsize)) 145 - endext++; 146 - extcount = endext - startext; 144 + do_div(endext, sc->mp->m_sb.sb_rextsize); 145 + extcount = endext - startext + 1; 147 146 xfs_ilock(sc->mp->m_rbmip, XFS_ILOCK_SHARED | XFS_ILOCK_RTBITMAP); 148 147 error = xfs_rtalloc_extent_is_free(sc->mp, sc->tp, startext, extcount, 149 148 &is_free);