diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2017-12-22 13:14:34 -0800 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-01-02 10:16:32 -0800 |
commit | b4d8ad7fd3a18e6d92d4ebe858185c704604a57d (patch) | |
tree | 6c26c75b1a436f78f53b285c3ab676ea3098831f /fs/xfs/xfs_iomap.c | |
parent | 3a3882ff26fbdbaf5f7e13f6a0bccfbf7121041d (diff) | |
download | linux-stable-b4d8ad7fd3a18e6d92d4ebe858185c704604a57d.tar.gz linux-stable-b4d8ad7fd3a18e6d92d4ebe858185c704604a57d.tar.bz2 linux-stable-b4d8ad7fd3a18e6d92d4ebe858185c704604a57d.zip |
xfs: fix s_maxbytes overflow problems
Fix some integer overflow problems if offset + count happen to be large
enough to cause an integer overflow.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r-- | fs/xfs/xfs_iomap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 7ab52a8bc0a9..66e1edbfb2b2 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -1006,7 +1006,7 @@ xfs_file_iomap_begin( } ASSERT(offset <= mp->m_super->s_maxbytes); - if ((xfs_fsize_t)offset + length > mp->m_super->s_maxbytes) + if (offset > mp->m_super->s_maxbytes - length) length = mp->m_super->s_maxbytes - offset; offset_fsb = XFS_B_TO_FSBT(mp, offset); end_fsb = XFS_B_TO_FSB(mp, offset + length); |