diff options
author | Nick Piggin <npiggin@suse.de> | 2007-07-20 11:31:45 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-20 19:44:19 +0400 |
commit | 1833633803c7ef4d8f09877d3f1549cbd252f477 (patch) | |
tree | ce69505de705701f838bd77c6b6b6bc18529bed0 /fs/ecryptfs | |
parent | e228929bc257b963523ed75aa60d2ad77ece2189 (diff) | |
download | linux-1833633803c7ef4d8f09877d3f1549cbd252f477.tar.xz |
fix some conversion overflows
Fix page index to offset conversion overflows in buffer layer, ecryptfs,
and ocfs2.
It would be nice to convert the whole tree to page_offset, but for now
just fix the bugs.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Michael Halcrow <mhalcrow@us.ibm.com>
Cc: Mark Fasheh <mark.fasheh@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs')
-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, if (!PageUptodate(page)) rc = ecryptfs_do_readpage(file, page, page->index); if (page->index != 0) { - loff_t end_of_prev_pg_pos = - (((loff_t)page->index << PAGE_CACHE_SHIFT) - 1); + loff_t end_of_prev_pg_pos = page_offset(page) - 1; if (end_of_prev_pg_pos > i_size_read(page->mapping->host)) { rc = ecryptfs_truncate(file->f_path.dentry, @@ -736,7 +735,7 @@ static int ecryptfs_commit_write(struct file *file, struct page *page, goto out; } inode->i_blocks = lower_inode->i_blocks; - pos = (page->index << PAGE_CACHE_SHIFT) + to; + pos = page_offset(page) + to; if (pos > i_size_read(inode)) { i_size_write(inode, pos); ecryptfs_printk(KERN_DEBUG, "Expanded file size to " |