diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-04-08 15:06:12 +0800 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-04-20 23:02:50 -0400 |
commit | 3939fcde24473dc09ce16e922c88df9b3bee45d9 (patch) | |
tree | fe1525d311cad56f25323a659e6c1811b22c0a8d /fs/xattr.c | |
parent | 3eac8778a237d83a1e553eba0c6f4fd4b39eeec0 (diff) | |
download | kernel_i9300_mainline-3939fcde24473dc09ce16e922c88df9b3bee45d9.zip kernel_i9300_mainline-3939fcde24473dc09ce16e922c88df9b3bee45d9.tar.gz kernel_i9300_mainline-3939fcde24473dc09ce16e922c88df9b3bee45d9.tar.bz2 |
xattr: 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>
Diffstat (limited to 'fs/xattr.c')
-rw-r--r-- | fs/xattr.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -237,13 +237,9 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value, if (size) { if (size > XATTR_SIZE_MAX) return -E2BIG; - kvalue = kmalloc(size, GFP_KERNEL); - if (!kvalue) - return -ENOMEM; - if (copy_from_user(kvalue, value, size)) { - kfree(kvalue); - return -EFAULT; - } + kvalue = memdup_user(value, size); + if (IS_ERR(kvalue)) + return PTR_ERR(kvalue); } error = vfs_setxattr(d, kname, kvalue, size, flags); |