diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2007-05-09 05:33:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:49 -0400 |
commit | 92f4c701aad794de9e4cf7341d0a486aed027c46 (patch) | |
tree | 59a47427d43670a50409fc91d68a325e7cfa0ab7 /fs/binfmt_misc.c | |
parent | 884c3d751093446918c2f7a4b2c745f28cf91c39 (diff) |
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>
Diffstat (limited to 'fs/binfmt_misc.c')
-rw-r--r-- | fs/binfmt_misc.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 18657f001b43..72d0b412c376 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -675,19 +675,8 @@ static ssize_t | |||
675 | bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | 675 | bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) |
676 | { | 676 | { |
677 | char *s = enabled ? "enabled" : "disabled"; | 677 | char *s = enabled ? "enabled" : "disabled"; |
678 | int len = strlen(s); | ||
679 | loff_t pos = *ppos; | ||
680 | 678 | ||
681 | if (pos < 0) | 679 | return simple_read_from_buffer(buf, nbytes, ppos, s, strlen(s)); |
682 | return -EINVAL; | ||
683 | if (pos >= len) | ||
684 | return 0; | ||
685 | if (len < pos + nbytes) | ||
686 | nbytes = len - pos; | ||
687 | if (copy_to_user(buf, s + pos, nbytes)) | ||
688 | return -EFAULT; | ||
689 | *ppos = pos + nbytes; | ||
690 | return nbytes; | ||
691 | } | 680 | } |
692 | 681 | ||
693 | static ssize_t bm_status_write(struct file * file, const char __user * buffer, | 682 | static ssize_t bm_status_write(struct file * file, const char __user * buffer, |