X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=sidebyside;f=fs%2Fbinfmt_misc.c;h=72d0b412c376641428244fac1acab7684b7cc748;hb=5b982c5bb7db5cfbc15236d9d45cec32e5472ed5;hp=e6f57990b121650647663f95f33727280cf22c4d;hpb=93bbad8fe13a25dcf7f3bc628a71d1a7642ae61b;p=powerpc.git diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index e6f57990b1..72d0b412c3 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -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, @@ -727,8 +716,8 @@ static const struct super_operations s_ops = { static int bm_fill_super(struct super_block * sb, void * data, int silent) { static struct tree_descr bm_files[] = { - [1] = {"status", &bm_status_operations, S_IWUSR|S_IRUGO}, - [2] = {"register", &bm_register_operations, S_IWUSR}, + [2] = {"status", &bm_status_operations, S_IWUSR|S_IRUGO}, + [3] = {"register", &bm_register_operations, S_IWUSR}, /* last one */ {""} }; int err = simple_fill_super(sb, 0x42494e4d, bm_files);