aboutsummaryrefslogtreecommitdiff
path: root/fs/sysfs/bin.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2009-04-30 15:36:52 +0000
committerSteve French <sfrench@us.ibm.com>2009-04-30 15:36:52 +0000
commit912bc6ae3de99c7bada4577d4341ace4ee59b5be (patch)
tree28fd1a4bb9e4b05aa833285b46df169f12c0e24d /fs/sysfs/bin.c
parentd37dc42ab6f040b8f0f2962ab219c5b2accf748d (diff)
parent091438dd5668396328a3419abcbc6591159eb8d1 (diff)
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs/sysfs/bin.c')
-rw-r--r--fs/sysfs/bin.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 93e0c0281d4..9345806c885 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;
}