diff options
author | Nathan Scott <nathans@sgi.com> | 2005-11-25 16:41:57 +1100 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-11-25 16:41:57 +1100 |
commit | a4656391b76ed93faed724c5963f033164ee477e (patch) | |
tree | 25868e009dba991b9e85bbf6eaf102bf9a318056 /fs | |
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')
-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 c6108971b4e..94d3cdfbf9b 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( int retpbbm = 1; int error; - if (blocks) { - offset = blocks << inode->i_blkbits; /* 64 bit goodness */ - size = (ssize_t) min_t(xfs_off_t, offset, LONG_MAX); - } else { - size = 1 << inode->i_blkbits; - } offset = (xfs_off_t)iblock << inode->i_blkbits; + if (blocks) + size = (ssize_t) min_t(xfs_off_t, LONG_MAX, + (xfs_off_t)blocks << inode->i_blkbits); + else + size = 1 << inode->i_blkbits; VOP_BMAP(vp, offset, size, create ? flags : BMAPI_READ, &iomap, &retpbbm, error); @@ -1007,7 +1006,7 @@ __linvfs_get_block( ASSERT(iomap.iomap_bsize - iomap.iomap_delta > 0); offset = min_t(xfs_off_t, iomap.iomap_bsize - iomap.iomap_delta, - blocks << inode->i_blkbits); + (xfs_off_t)blocks << inode->i_blkbits); bh_result->b_size = (u32) min_t(xfs_off_t, UINT_MAX, offset); } |