Skip to content

Commit

Permalink
xattr: use memdup_user()
Browse files Browse the repository at this point in the history
Remove open-coded memdup_user()

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Li Zefan authored and Al Viro committed Apr 21, 2009
1 parent 3eac877 commit 3939fcd
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3939fcd

Please sign in to comment.