* [PATCH 6/8] xfs: fix unsigned underflow
@ 2010-07-15 18:46 Kulikov Vasiliy
2010-07-15 21:21 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Kulikov Vasiliy @ 2010-07-15 18:46 UTC (permalink / raw)
To: kernel-janitors
Cc: Alex Elder, Felix Blyakher, linux-kernel, xfs, xfs-masters,
Dave Chinner, Christoph Hellwig
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>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 6/8] xfs: fix unsigned underflow
2010-07-15 18:46 [PATCH 6/8] xfs: fix unsigned underflow Kulikov Vasiliy
@ 2010-07-15 21:21 ` Christoph Hellwig
2010-07-20 19:35 ` Alex Elder
0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2010-07-15 21:21 UTC (permalink / raw)
To: Kulikov Vasiliy
Cc: kernel-janitors, Dave Chinner, Felix Blyakher, linux-kernel, xfs,
xfs-masters, Alex Elder, Christoph Hellwig
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 <segooon@gmail.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/8] xfs: fix unsigned underflow
2010-07-15 21:21 ` Christoph Hellwig
@ 2010-07-20 19:35 ` Alex Elder
2010-07-20 20:21 ` Vasiliy Kulikov
2010-07-20 23:12 ` Dave Chinner
0 siblings, 2 replies; 5+ messages in thread
From: Alex Elder @ 2010-07-20 19:35 UTC (permalink / raw)
To: Kulikov Vasiliy; +Cc: Christoph Hellwig, kernel-janitors, linux-kernel, xfs
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 <segooon@gmail.com>
>
> Looks good,
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
Looks good to me too. Do you want me to pull this
in via the XFS tree, or do you have other plans?
-Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/8] xfs: fix unsigned underflow
2010-07-20 19:35 ` Alex Elder
@ 2010-07-20 20:21 ` Vasiliy Kulikov
2010-07-20 23:12 ` Dave Chinner
1 sibling, 0 replies; 5+ messages in thread
From: Vasiliy Kulikov @ 2010-07-20 20:21 UTC (permalink / raw)
To: Alex Elder; +Cc: Christoph Hellwig, kernel-janitors, linux-kernel, xfs
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 <segooon@gmail.com>
> >
> > Looks good,
> >
> > Reviewed-by: Christoph Hellwig <hch@lst.de>
> >
>
> 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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 6/8] xfs: fix unsigned underflow
2010-07-20 19:35 ` Alex Elder
2010-07-20 20:21 ` Vasiliy Kulikov
@ 2010-07-20 23:12 ` Dave Chinner
1 sibling, 0 replies; 5+ messages in thread
From: Dave Chinner @ 2010-07-20 23:12 UTC (permalink / raw)
To: Alex Elder
Cc: Christoph Hellwig, kernel-janitors, Kulikov Vasiliy, linux-kernel,
xfs
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 <segooon@gmail.com>
> >
> > Looks good,
> >
> > Reviewed-by: Christoph Hellwig <hch@lst.de>
> >
>
> 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
david@fromorbit.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-07-20 23:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-15 18:46 [PATCH 6/8] xfs: fix unsigned underflow Kulikov Vasiliy
2010-07-15 21:21 ` Christoph Hellwig
2010-07-20 19:35 ` Alex Elder
2010-07-20 20:21 ` Vasiliy Kulikov
2010-07-20 23:12 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).