summaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/mmap.c
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@us.ibm.com>2007-06-27 14:09:45 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-28 11:34:53 -0700
commitd4c5cdb3e099da7cc64df622b02ff7659babe16e (patch)
tree2d1662e51e62b8881f386aa79474d7add3db7bca /fs/ecryptfs/mmap.c
parente10f281bca03f45bdec91e67645c394eaec2f8f6 (diff)
downloadlinux-d4c5cdb3e099da7cc64df622b02ff7659babe16e.tar.bz2
zero out last page for llseek/write
When one llseek's past the end of the file and then writes, every page past the previous end of the file should be cleared. Trevor found that the code, as is, does not assure that the very last page is always cleared. This patch takes care of that. Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs/mmap.c')
-rw-r--r--fs/ecryptfs/mmap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 6df410c77264..7d5a43cb0d5c 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -422,6 +422,8 @@ static int ecryptfs_prepare_write(struct file *file, struct page *page,
goto out;
}
}
+ if (end_of_prev_pg_pos + 1 > i_size_read(page->mapping->host))
+ zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0);
}
out:
return rc;