aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r--fs/ecryptfs/mmap.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 0770c4b66f53..88ea6697908f 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -364,18 +364,14 @@ static int fill_zeros_to_end_of_page(struct page *page, unsigned int to)
364{ 364{
365 struct inode *inode = page->mapping->host; 365 struct inode *inode = page->mapping->host;
366 int end_byte_in_page; 366 int end_byte_in_page;
367 char *page_virt;
368 367
369 if ((i_size_read(inode) / PAGE_CACHE_SIZE) != page->index) 368 if ((i_size_read(inode) / PAGE_CACHE_SIZE) != page->index)
370 goto out; 369 goto out;
371 end_byte_in_page = i_size_read(inode) % PAGE_CACHE_SIZE; 370 end_byte_in_page = i_size_read(inode) % PAGE_CACHE_SIZE;
372 if (to > end_byte_in_page) 371 if (to > end_byte_in_page)
373 end_byte_in_page = to; 372 end_byte_in_page = to;
374 page_virt = kmap_atomic(page, KM_USER0); 373 zero_user_page(page, end_byte_in_page,
375 memset((page_virt + end_byte_in_page), 0, 374 PAGE_CACHE_SIZE - end_byte_in_page, KM_USER0);
376 (PAGE_CACHE_SIZE - end_byte_in_page));
377 kunmap_atomic(page_virt, KM_USER0);
378 flush_dcache_page(page);
379out: 375out:
380 return 0; 376 return 0;
381} 377}
@@ -740,7 +736,6 @@ int write_zeros(struct file *file, pgoff_t index, int start, int num_zeros)
740{ 736{
741 int rc = 0; 737 int rc = 0;
742 struct page *tmp_page; 738 struct page *tmp_page;
743 char *tmp_page_virt;
744 739
745 tmp_page = ecryptfs_get1page(file, index); 740 tmp_page = ecryptfs_get1page(file, index);
746 if (IS_ERR(tmp_page)) { 741 if (IS_ERR(tmp_page)) {
@@ -757,10 +752,7 @@ int write_zeros(struct file *file, pgoff_t index, int start, int num_zeros)
757 page_cache_release(tmp_page); 752 page_cache_release(tmp_page);
758 goto out; 753 goto out;
759 } 754 }
760 tmp_page_virt = kmap_atomic(tmp_page, KM_USER0); 755 zero_user_page(tmp_page, start, num_zeros, KM_USER0);
761 memset(((char *)tmp_page_virt + start), 0, num_zeros);
762 kunmap_atomic(tmp_page_virt, KM_USER0);
763 flush_dcache_page(tmp_page);
764 rc = ecryptfs_commit_write(file, tmp_page, start, start + num_zeros); 756 rc = ecryptfs_commit_write(file, tmp_page, start, start + num_zeros);
765 if (rc < 0) { 757 if (rc < 0) {
766 ecryptfs_printk(KERN_ERR, "Error attempting to write zero's " 758 ecryptfs_printk(KERN_ERR, "Error attempting to write zero's "