Skip to content

Commit

Permalink
xfs: fix unsigned underflow in xfs_free_eofblocks
Browse files Browse the repository at this point in the history
map_len is unsigned. Checking map_len <= 0 is buggy when it should be
below zero. So, check exact expression instead of map_len.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
  • Loading branch information
Kulikov Vasiliy authored and Alex Elder committed Jul 26, 2010
1 parent aea1b95 commit 3f34885
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/xfs/xfs_vnodeops.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,9 @@ xfs_free_eofblocks(
*/
end_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)ip->i_size));
last_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAXIOFFSET(mp));
map_len = last_fsb - end_fsb;
if (map_len <= 0)
if (last_fsb <= end_fsb)
return 0;
map_len = last_fsb - end_fsb;

nimaps = 1;
xfs_ilock(ip, XFS_ILOCK_SHARED);
Expand Down

0 comments on commit 3f34885

Please sign in to comment.