aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/binfmt_misc.c')
-rw-r--r--fs/binfmt_misc.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index e6f57990b121..72d0b412c376 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -675,19 +675,8 @@ static ssize_t
675bm_status_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) 675bm_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
693static ssize_t bm_status_write(struct file * file, const char __user * buffer, 682static ssize_t bm_status_write(struct file * file, const char __user * buffer,
@@ -727,8 +716,8 @@ static const struct super_operations s_ops = {
727static int bm_fill_super(struct super_block * sb, void * data, int silent) 716static int bm_fill_super(struct super_block * sb, void * data, int silent)
728{ 717{
729 static struct tree_descr bm_files[] = { 718 static struct tree_descr bm_files[] = {
730 [1] = {"status", &bm_status_operations, S_IWUSR|S_IRUGO}, 719 [2] = {"status", &bm_status_operations, S_IWUSR|S_IRUGO},
731 [2] = {"register", &bm_register_operations, S_IWUSR}, 720 [3] = {"register", &bm_register_operations, S_IWUSR},
732 /* last one */ {""} 721 /* last one */ {""}
733 }; 722 };
734 int err = simple_fill_super(sb, 0x42494e4d, bm_files); 723 int err = simple_fill_super(sb, 0x42494e4d, bm_files);