Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 118039
b: refs/heads/master
c: 87b811c
h: refs/heads/master
i:
  118037: 109c6f2
  118035: f66101f
  118031: 66317d1
v: v3
  • Loading branch information
Eric Sandeen authored and Linus Torvalds committed Oct 30, 2008
1 parent f630617 commit 0e213f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ce05fcc30ea41c85f9d50bee1ce289f7cb7fb223
refs/heads/master: 87b811c3f96559e466403e22b1fa99d472571625
15 changes: 8 additions & 7 deletions trunk/fs/ecryptfs/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,7 @@ struct kmem_cache *ecryptfs_header_cache_2;
/**
* ecryptfs_write_headers_virt
* @page_virt: The virtual address to write the headers to
* @max: The size of memory allocated at page_virt
* @size: Set to the number of bytes written by this function
* @crypt_stat: The cryptographic context
* @ecryptfs_dentry: The eCryptfs dentry
Expand Down Expand Up @@ -1278,7 +1279,8 @@ struct kmem_cache *ecryptfs_header_cache_2;
*
* Returns zero on success
*/
static int ecryptfs_write_headers_virt(char *page_virt, size_t *size,
static int ecryptfs_write_headers_virt(char *page_virt, size_t max,
size_t *size,
struct ecryptfs_crypt_stat *crypt_stat,
struct dentry *ecryptfs_dentry)
{
Expand All @@ -1296,7 +1298,7 @@ static int ecryptfs_write_headers_virt(char *page_virt, size_t *size,
offset += written;
rc = ecryptfs_generate_key_packet_set((page_virt + offset), crypt_stat,
ecryptfs_dentry, &written,
PAGE_CACHE_SIZE - offset);
max - offset);
if (rc)
ecryptfs_printk(KERN_WARNING, "Error generating key packet "
"set; rc = [%d]\n", rc);
Expand Down Expand Up @@ -1368,14 +1370,14 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry)
goto out;
}
/* Released in this function */
virt = kzalloc(crypt_stat->num_header_bytes_at_front, GFP_KERNEL);
virt = (char *)get_zeroed_page(GFP_KERNEL);
if (!virt) {
printk(KERN_ERR "%s: Out of memory\n", __func__);
rc = -ENOMEM;
goto out;
}
rc = ecryptfs_write_headers_virt(virt, &size, crypt_stat,
ecryptfs_dentry);
rc = ecryptfs_write_headers_virt(virt, PAGE_CACHE_SIZE, &size,
crypt_stat, ecryptfs_dentry);
if (unlikely(rc)) {
printk(KERN_ERR "%s: Error whilst writing headers; rc = [%d]\n",
__func__, rc);
Expand All @@ -1393,8 +1395,7 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry)
goto out_free;
}
out_free:
memset(virt, 0, crypt_stat->num_header_bytes_at_front);
kfree(virt);
free_page((unsigned long)virt);
out:
return rc;
}
Expand Down

0 comments on commit 0e213f3

Please sign in to comment.