Commit 3939fcde authored by Li Zefan's avatar Li Zefan Committed by Al Viro

xattr: use memdup_user()

Remove open-coded memdup_user()
Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 3eac8778
...@@ -237,13 +237,9 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value, ...@@ -237,13 +237,9 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value,
if (size) { if (size) {
if (size > XATTR_SIZE_MAX) if (size > XATTR_SIZE_MAX)
return -E2BIG; return -E2BIG;
kvalue = kmalloc(size, GFP_KERNEL); kvalue = memdup_user(value, size);
if (!kvalue) if (IS_ERR(kvalue))
return -ENOMEM; return PTR_ERR(kvalue);
if (copy_from_user(kvalue, value, size)) {
kfree(kvalue);
return -EFAULT;
}
} }
error = vfs_setxattr(d, kname, kvalue, size, flags); error = vfs_setxattr(d, kname, kvalue, size, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment