diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-04-08 09:07:30 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-04-21 05:02:50 +0200 |
commit | 1c8542c7bb239ef02fe21477acd9cdac04c1b640 (patch) | |
tree | 45d9f29f241203608866f8246a699bc00b6ecf6b /fs/sysfs | |
parent | btrfs: use memdup_user() (diff) | |
download | linux-1c8542c7bb239ef02fe21477acd9cdac04c1b640.tar.xz linux-1c8542c7bb239ef02fe21477acd9cdac04c1b640.zip |
sysfs: 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/sysfs')
-rw-r--r-- | fs/sysfs/bin.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index 93e0c0281d45..9345806c8853 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c @@ -157,14 +157,9 @@ static ssize_t write(struct file *file, const char __user *userbuf, count = size - offs; } - temp = kmalloc(count, GFP_KERNEL); - if (!temp) - return -ENOMEM; - - if (copy_from_user(temp, userbuf, count)) { - count = -EFAULT; - goto out_free; - } + temp = memdup_user(userbuf, count); + if (IS_ERR(temp)) + return PTR_ERR(temp); mutex_lock(&bb->mutex); @@ -176,8 +171,6 @@ static ssize_t write(struct file *file, const char __user *userbuf, if (count > 0) *off = offs + count; -out_free: - kfree(temp); return count; } |