Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ecryptfs: use ZERO_PAGE instead of allocating zeroed memory in truncate_upper

Use the existing pre-zeroed memory instead of allocating a new chunk.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Tyler Hicks <code@tyhicks.com>

authored by

Christoph Hellwig and committed by
Tyler Hicks
b19fe74e b1091873

+2 -9
+2 -9
fs/ecryptfs/inode.c
··· 771 771 */ 772 772 num_zeros = PAGE_SIZE - (ia->ia_size & ~PAGE_MASK); 773 773 if (num_zeros) { 774 - char *zeros_virt; 775 - 776 - zeros_virt = kzalloc(num_zeros, GFP_KERNEL); 777 - if (!zeros_virt) { 778 - rc = -ENOMEM; 779 - goto out; 780 - } 781 - rc = ecryptfs_write(inode, zeros_virt, ia->ia_size, num_zeros); 782 - kfree(zeros_virt); 774 + rc = ecryptfs_write(inode, page_address(ZERO_PAGE(0)), 775 + ia->ia_size, num_zeros); 783 776 if (rc) { 784 777 pr_err("Error attempting to zero out the remainder of the end page on reducing truncate; rc = [%d]\n", 785 778 rc);