mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
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>
This commit is contained in:
parent
aea1b95321
commit
3f34885cd7
1 changed files with 2 additions and 2 deletions
|
@ -589,9 +589,9 @@ xfs_free_eofblocks(
|
||||||
*/
|
*/
|
||||||
end_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)ip->i_size));
|
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));
|
last_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_MAXIOFFSET(mp));
|
||||||
map_len = last_fsb - end_fsb;
|
if (last_fsb <= end_fsb)
|
||||||
if (map_len <= 0)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
map_len = last_fsb - end_fsb;
|
||||||
|
|
||||||
nimaps = 1;
|
nimaps = 1;
|
||||||
xfs_ilock(ip, XFS_ILOCK_SHARED);
|
xfs_ilock(ip, XFS_ILOCK_SHARED);
|
||||||
|
|
Loading…
Reference in a new issue