Skip to content

Commit

Permalink
zero out last page for llseek/write
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Halcrow authored and Linus Torvalds committed Jun 28, 2007
1 parent e10f281 commit d4c5cdb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/ecryptfs/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d4c5cdb

Please sign in to comment.