Skip to content

Commit d7fd242

Browse files
jankaradjwong
authored andcommitted
xfs: Fix off-by-in in loop termination in xfs_find_get_desired_pgoff()
There is an off-by-one error in loop termination conditions in xfs_find_get_desired_pgoff() since 'end' may index a page beyond end of desired range if 'endoff' is page aligned. It doesn't have any visible effects but still it is good to fix it. Signed-off-by: Jan Kara <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 5375023 commit d7fd242

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/xfs/xfs_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ xfs_find_get_desired_pgoff(
10431043

10441044
index = startoff >> PAGE_SHIFT;
10451045
endoff = XFS_FSB_TO_B(mp, map->br_startoff + map->br_blockcount);
1046-
end = endoff >> PAGE_SHIFT;
1046+
end = (endoff - 1) >> PAGE_SHIFT;
10471047
do {
10481048
int want;
10491049
unsigned nr_pages;

0 commit comments

Comments
 (0)