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 <[email protected]>
---
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 65e0879..66d585c 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -591,9 +591,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);
--
1.7.0.4
On Thu, Jul 15, 2010 at 10:46:45PM +0400, Kulikov Vasiliy wrote:
> 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 <[email protected]>
Looks good,
Reviewed-by: Christoph Hellwig <[email protected]>
On Thu, 2010-07-15 at 17:21 -0400, Christoph Hellwig wrote:
> On Thu, Jul 15, 2010 at 10:46:45PM +0400, Kulikov Vasiliy wrote:
> > 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 <[email protected]>
>
> Looks good,
>
> Reviewed-by: Christoph Hellwig <[email protected]>
>
Looks good to me too. Do you want me to pull this
in via the XFS tree, or do you have other plans?
-Alex
On Tue, Jul 20, 2010 at 14:35 -0500, Alex Elder wrote:
> On Thu, 2010-07-15 at 17:21 -0400, Christoph Hellwig wrote:
> > On Thu, Jul 15, 2010 at 10:46:45PM +0400, Kulikov Vasiliy wrote:
> > > 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 <[email protected]>
> >
> > Looks good,
> >
> > Reviewed-by: Christoph Hellwig <[email protected]>
> >
>
> Looks good to me too. Do you want me to pull this
> in via the XFS tree, or do you have other plans?
Yes, pull it please.
>
> -Alex
>
On Tue, Jul 20, 2010 at 02:35:33PM -0500, Alex Elder wrote:
> On Thu, 2010-07-15 at 17:21 -0400, Christoph Hellwig wrote:
> > On Thu, Jul 15, 2010 at 10:46:45PM +0400, Kulikov Vasiliy wrote:
> > > 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 <[email protected]>
> >
> > Looks good,
> >
> > Reviewed-by: Christoph Hellwig <[email protected]>
> >
>
> Looks good to me too. Do you want me to pull this
> in via the XFS tree, or do you have other plans?
Already got it, Alex.
Cheers,
Dave.
--
Dave Chinner
[email protected]