diff options
Diffstat (limited to 'fs/gfs2/aops.c')
-rw-r--r-- | fs/gfs2/aops.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index 0c1d0b82dcf1..a739a0a48067 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
@@ -418,6 +418,7 @@ static int gfs2_jdata_writepages(struct address_space *mapping, | |||
418 | static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) | 418 | static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) |
419 | { | 419 | { |
420 | struct buffer_head *dibh; | 420 | struct buffer_head *dibh; |
421 | u64 dsize = i_size_read(&ip->i_inode); | ||
421 | void *kaddr; | 422 | void *kaddr; |
422 | int error; | 423 | int error; |
423 | 424 | ||
@@ -437,9 +438,10 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) | |||
437 | return error; | 438 | return error; |
438 | 439 | ||
439 | kaddr = kmap_atomic(page, KM_USER0); | 440 | kaddr = kmap_atomic(page, KM_USER0); |
440 | memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), | 441 | if (dsize > (dibh->b_size - sizeof(struct gfs2_dinode))) |
441 | ip->i_disksize); | 442 | dsize = (dibh->b_size - sizeof(struct gfs2_dinode)); |
442 | memset(kaddr + ip->i_disksize, 0, PAGE_CACHE_SIZE - ip->i_disksize); | 443 | memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), dsize); |
444 | memset(kaddr + dsize, 0, PAGE_CACHE_SIZE - dsize); | ||
443 | kunmap_atomic(kaddr, KM_USER0); | 445 | kunmap_atomic(kaddr, KM_USER0); |
444 | flush_dcache_page(page); | 446 | flush_dcache_page(page); |
445 | brelse(dibh); | 447 | brelse(dibh); |