mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 06:32:08 +00:00
use simple_read_from_buffer() in fs/
Cleanup using simple_read_from_buffer() in binfmt_misc, configfs, and sysfs. Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: Joel Becker <joel.becker@oracle.com> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
884c3d7510
commit
92f4c701aa
3 changed files with 5 additions and 74 deletions
|
@ -675,19 +675,8 @@ static ssize_t
|
|||
bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
|
||||
{
|
||||
char *s = enabled ? "enabled" : "disabled";
|
||||
int len = strlen(s);
|
||||
loff_t pos = *ppos;
|
||||
|
||||
if (pos < 0)
|
||||
return -EINVAL;
|
||||
if (pos >= len)
|
||||
return 0;
|
||||
if (len < pos + nbytes)
|
||||
nbytes = len - pos;
|
||||
if (copy_to_user(buf, s + pos, nbytes))
|
||||
return -EFAULT;
|
||||
*ppos = pos + nbytes;
|
||||
return nbytes;
|
||||
return simple_read_from_buffer(buf, nbytes, ppos, s, strlen(s));
|
||||
}
|
||||
|
||||
static ssize_t bm_status_write(struct file * file, const char __user * buffer,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue