diff options
Diffstat (limited to 'fs/ecryptfs/mmap.c')
-rw-r--r-- | fs/ecryptfs/mmap.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index 7d5a43cb0d5c..e4ab7bc14efe 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c | |||
@@ -409,8 +409,7 @@ static int ecryptfs_prepare_write(struct file *file, struct page *page, | |||
409 | if (!PageUptodate(page)) | 409 | if (!PageUptodate(page)) |
410 | rc = ecryptfs_do_readpage(file, page, page->index); | 410 | rc = ecryptfs_do_readpage(file, page, page->index); |
411 | if (page->index != 0) { | 411 | if (page->index != 0) { |
412 | loff_t end_of_prev_pg_pos = | 412 | loff_t end_of_prev_pg_pos = page_offset(page) - 1; |
413 | (((loff_t)page->index << PAGE_CACHE_SHIFT) - 1); | ||
414 | 413 | ||
415 | if (end_of_prev_pg_pos > i_size_read(page->mapping->host)) { | 414 | if (end_of_prev_pg_pos > i_size_read(page->mapping->host)) { |
416 | rc = ecryptfs_truncate(file->f_path.dentry, | 415 | rc = ecryptfs_truncate(file->f_path.dentry, |
@@ -736,7 +735,7 @@ static int ecryptfs_commit_write(struct file *file, struct page *page, | |||
736 | goto out; | 735 | goto out; |
737 | } | 736 | } |
738 | inode->i_blocks = lower_inode->i_blocks; | 737 | inode->i_blocks = lower_inode->i_blocks; |
739 | pos = (page->index << PAGE_CACHE_SHIFT) + to; | 738 | pos = page_offset(page) + to; |
740 | if (pos > i_size_read(inode)) { | 739 | if (pos > i_size_read(inode)) { |
741 | i_size_write(inode, pos); | 740 | i_size_write(inode, pos); |
742 | ecryptfs_printk(KERN_DEBUG, "Expanded file size to " | 741 | ecryptfs_printk(KERN_DEBUG, "Expanded file size to " |