diff options
author | Nathan Scott <nathans@sgi.com> | 2005-11-25 00:41:57 -0500 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-11-25 00:41:57 -0500 |
commit | a4656391b76ed93faed724c5963f033164ee477e (patch) | |
tree | 25868e009dba991b9e85bbf6eaf102bf9a318056 /fs/xfs/linux-2.6 | |
parent | f33c6797bccc695c4c85885f2c676ad4c8fed98d (diff) |
[XFS] Fix a 32 bit value wraparound when providing a mapping for a large
direct write.
SGI-PV: 944820
SGI-Modid: xfs-linux-melb:xfs-kern:24351a
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_aops.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c index c6108971b4e6..94d3cdfbf9b8 100644 --- a/fs/xfs/linux-2.6/xfs_aops.c +++ b/fs/xfs/linux-2.6/xfs_aops.c | |||
@@ -941,13 +941,12 @@ __linvfs_get_block( | |||
941 | int retpbbm = 1; | 941 | int retpbbm = 1; |
942 | int error; | 942 | int error; |
943 | 943 | ||
944 | if (blocks) { | ||
945 | offset = blocks << inode->i_blkbits; /* 64 bit goodness */ | ||
946 | size = (ssize_t) min_t(xfs_off_t, offset, LONG_MAX); | ||
947 | } else { | ||
948 | size = 1 << inode->i_blkbits; | ||
949 | } | ||
950 | offset = (xfs_off_t)iblock << inode->i_blkbits; | 944 | offset = (xfs_off_t)iblock << inode->i_blkbits; |
945 | if (blocks) | ||
946 | size = (ssize_t) min_t(xfs_off_t, LONG_MAX, | ||
947 | (xfs_off_t)blocks << inode->i_blkbits); | ||
948 | else | ||
949 | size = 1 << inode->i_blkbits; | ||
951 | 950 | ||
952 | VOP_BMAP(vp, offset, size, | 951 | VOP_BMAP(vp, offset, size, |
953 | create ? flags : BMAPI_READ, &iomap, &retpbbm, error); | 952 | create ? flags : BMAPI_READ, &iomap, &retpbbm, error); |
@@ -1007,7 +1006,7 @@ __linvfs_get_block( | |||
1007 | ASSERT(iomap.iomap_bsize - iomap.iomap_delta > 0); | 1006 | ASSERT(iomap.iomap_bsize - iomap.iomap_delta > 0); |
1008 | offset = min_t(xfs_off_t, | 1007 | offset = min_t(xfs_off_t, |
1009 | iomap.iomap_bsize - iomap.iomap_delta, | 1008 | iomap.iomap_bsize - iomap.iomap_delta, |
1010 | blocks << inode->i_blkbits); | 1009 | (xfs_off_t)blocks << inode->i_blkbits); |
1011 | bh_result->b_size = (u32) min_t(xfs_off_t, UINT_MAX, offset); | 1010 | bh_result->b_size = (u32) min_t(xfs_off_t, UINT_MAX, offset); |
1012 | } | 1011 | } |
1013 | 1012 | ||