projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dae7b66
)
sysfs: use memdup_user()
author
Li Zefan
<
[email protected]
>
Wed, 8 Apr 2009 07:07:30 +0000
(15:07 +0800)
committer
Al Viro
<
[email protected]
>
Tue, 21 Apr 2009 03:02:50 +0000
(23:02 -0400)
Remove open-coded memdup_user().
Signed-off-by: Li Zefan <
[email protected]
>
Signed-off-by: Al Viro <
[email protected]
>
fs/sysfs/bin.c
patch
|
blob
|
history
diff --git
a/fs/sysfs/bin.c
b/fs/sysfs/bin.c
index 93e0c0281d4511cc1319bcb0fdb2ed05eb1453a4..9345806c8853e369ba34695542081bb2e3f347db 100644
(file)
--- 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;
}