diff options
author | Kulikov Vasiliy <segooon@gmail.com> | 2010-07-20 03:54:28 -0400 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2010-07-26 14:16:50 -0400 |
commit | 3f34885cd7c6a3f4deea48e3bbc704d91d5704f4 (patch) | |
tree | c03bcdaf42d70d7e08df2cd629d5308870660bed | |
parent | aea1b9532143218f8599ecedbbd6bfbf812385e1 (diff) |
xfs: fix unsigned underflow in xfs_free_eofblocks
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>
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 9865e1136017..3ac137dd531b 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -589,9 +589,9 @@ xfs_free_eofblocks( | |||
589 | */ | 589 | */ |
590 | end_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)ip->i_size)); | 590 | end_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)ip->i_size)); |
591 | last_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAXIOFFSET(mp)); | 591 | last_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAXIOFFSET(mp)); |
592 | map_len = last_fsb - end_fsb; | 592 | if (last_fsb <= end_fsb) |
593 | if (map_len <= 0) | ||
594 | return 0; | 593 | return 0; |
594 | map_len = last_fsb - end_fsb; | ||
595 | 595 | ||
596 | nimaps = 1; | 596 | nimaps = 1; |
597 | xfs_ilock(ip, XFS_ILOCK_SHARED); | 597 | xfs_ilock(ip, XFS_ILOCK_SHARED); |