X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=fs%2Fbinfmt_misc.c;h=330fd3fe8546570732da73f6957f31dc5778eb47;hb=e8edc6e03a5c8562dc70a6d969f732bdb355a7e7;hp=c2e08252af35d5dd3140ff32d1cf79bbfd3521c7;hpb=fb7665544dd60e016494cd5531f5b65ddae22ddc;p=powerpc.git diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index c2e08252af..330fd3fe85 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c @@ -18,7 +18,7 @@ #include #include - +#include #include #include #include @@ -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, @@ -719,7 +708,7 @@ static const struct file_operations bm_status_operations = { /* Superblock handling */ -static struct super_operations s_ops = { +static const struct super_operations s_ops = { .statfs = simple_statfs, .clear_inode = bm_clear_inode, }; @@ -727,8 +716,8 @@ static 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);