ecryptfs: use memdup_user()

Remove open-coded memdup_user().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Li Zefan 2009-04-08 15:09:29 +08:00 committed by Al Viro
parent a9482ebcde
commit fd56d242b3
1 changed files with 5 additions and 10 deletions

View File

@ -418,18 +418,13 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf,
if (count == 0) if (count == 0)
goto out; goto out;
data = kmalloc(count, GFP_KERNEL);
if (!data) { data = memdup_user(buf, count);
printk(KERN_ERR "%s: Out of memory whilst attempting to " if (IS_ERR(data)) {
"kmalloc([%zd], GFP_KERNEL)\n", __func__, count); printk(KERN_ERR "%s: memdup_user returned error [%ld]\n",
__func__, PTR_ERR(data));
goto out; goto out;
} }
rc = copy_from_user(data, buf, count);
if (rc) {
printk(KERN_ERR "%s: copy_from_user returned error [%d]\n",
__func__, rc);
goto out_free;
}
sz = count; sz = count;
i = 0; i = 0;
switch (data[i++]) { switch (data[i++]) {