xfs: fix unsigned underflow
Subsystems (2)
PATCH 6/8 xfs: fix unsigned underflow
map_len is unsigned. Checking map_len <= 0 is buggy when it should be below zero. So, check exact expression instead of map_len.
--- fs/xfs/xfs_vnodeops.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/xfs/xfs_vnodeops.c +2 -2
@@ -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 );
Signature · 6 lines
1.7.0.4 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 4 lines · Kulikov Vasiliy
map_lenis unsigned. Checkingmap_len<= 0 is buggy when it should be below zero. So, check exact expression instead ofmap_len.Signed-off-by Kulikov Vasiliy <[email protected]>
Looks good,
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 10 lines · Christoph Hellwig
Quoted 4 lines · Kulikov Vasiliy
map_lenis unsigned. Checkingmap_len<= 0 is buggy when it should be below zero. So, check exact expression instead ofmap_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
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 7 lines · Alex Elder
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Kulikov Vasiliy
map_lenis unsigned. Checkingmap_len<= 0 is buggy when it should be below zero. So, check exact expression instead ofmap_len.Signed-off-by Kulikov Vasiliy <[email protected]>
Quoted 7 lines
Quoted 4 lines
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.
Quoted 3 lines
-Alex
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 7 lines · Alex Elder
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Kulikov Vasiliy
map_lenis unsigned. Checkingmap_len<= 0 is buggy when it should be below zero. So, check exact expression instead ofmap_len.Signed-off-by Kulikov Vasiliy <[email protected]>
Quoted 7 lines
Quoted 4 lines
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.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs