diff options
-rw-r--r-- | fs/f2fs/data.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 614e444e5297..93aae548cf80 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -255,15 +255,13 @@ static void f2fs_map_bh(struct super_block *sb, pgoff_t pgofs, | |||
255 | struct extent_info *ei, struct buffer_head *bh_result) | 255 | struct extent_info *ei, struct buffer_head *bh_result) |
256 | { | 256 | { |
257 | unsigned int blkbits = sb->s_blocksize_bits; | 257 | unsigned int blkbits = sb->s_blocksize_bits; |
258 | size_t count; | 258 | size_t max_size = bh_result->b_size; |
259 | size_t mapped_size; | ||
259 | 260 | ||
260 | clear_buffer_new(bh_result); | 261 | clear_buffer_new(bh_result); |
261 | map_bh(bh_result, sb, ei->blk + pgofs - ei->fofs); | 262 | map_bh(bh_result, sb, ei->blk + pgofs - ei->fofs); |
262 | count = ei->fofs + ei->len - pgofs; | 263 | mapped_size = (ei->fofs + ei->len - pgofs) << blkbits; |
263 | if (count < (UINT_MAX >> blkbits)) | 264 | bh_result->b_size = min(max_size, mapped_size); |
264 | bh_result->b_size = (count << blkbits); | ||
265 | else | ||
266 | bh_result->b_size = UINT_MAX; | ||
267 | } | 265 | } |
268 | 266 | ||
269 | static bool lookup_extent_info(struct inode *inode, pgoff_t pgofs, | 267 | static bool lookup_extent_info(struct inode *inode, pgoff_t pgofs, |