mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
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>
This commit is contained in:
parent
dae7b665cf
commit
1c8542c7bb
1 changed files with 3 additions and 10 deletions
|
@ -157,14 +157,9 @@ static ssize_t write(struct file *file, const char __user *userbuf,
|
||||||
count = size - offs;
|
count = size - offs;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = kmalloc(count, GFP_KERNEL);
|
temp = memdup_user(userbuf, count);
|
||||||
if (!temp)
|
if (IS_ERR(temp))
|
||||||
return -ENOMEM;
|
return PTR_ERR(temp);
|
||||||
|
|
||||||
if (copy_from_user(temp, userbuf, count)) {
|
|
||||||
count = -EFAULT;
|
|
||||||
goto out_free;
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_lock(&bb->mutex);
|
mutex_lock(&bb->mutex);
|
||||||
|
|
||||||
|
@ -176,8 +171,6 @@ static ssize_t write(struct file *file, const char __user *userbuf,
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
*off = offs + count;
|
*off = offs + count;
|
||||||
|
|
||||||
out_free:
|
|
||||||
kfree(temp);
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue