aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/file.c7
-rw-r--r--fs/fuse/inode.c3
2 files changed, 6 insertions, 4 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a02418c89d4b..2d3649e42599 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -966,14 +966,15 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
966 966
967 while (count) { 967 while (count) {
968 size_t nres; 968 size_t nres;
969 size_t nbytes = min(count, nmax); 969 size_t nbytes_limit = min(count, nmax);
970 int err = fuse_get_user_pages(req, buf, nbytes, !write); 970 size_t nbytes;
971 int err = fuse_get_user_pages(req, buf, nbytes_limit, !write);
971 if (err) { 972 if (err) {
972 res = err; 973 res = err;
973 break; 974 break;
974 } 975 }
975 nbytes = (req->num_pages << PAGE_SHIFT) - req->page_offset; 976 nbytes = (req->num_pages << PAGE_SHIFT) - req->page_offset;
976 nbytes = min(count, nbytes); 977 nbytes = min(nbytes_limit, nbytes);
977 if (write) 978 if (write)
978 nres = fuse_send_write(req, file, inode, pos, nbytes, 979 nres = fuse_send_write(req, file, inode, pos, nbytes,
979 current->files); 980 current->files);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 7d01c68852a8..0cef5ea319f3 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -584,6 +584,7 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
584 fc->bdi.ra_pages = min(fc->bdi.ra_pages, ra_pages); 584 fc->bdi.ra_pages = min(fc->bdi.ra_pages, ra_pages);
585 fc->minor = arg->minor; 585 fc->minor = arg->minor;
586 fc->max_write = arg->minor < 5 ? 4096 : arg->max_write; 586 fc->max_write = arg->minor < 5 ? 4096 : arg->max_write;
587 fc->max_write = min_t(unsigned, 4096, fc->max_write);
587 fc->conn_init = 1; 588 fc->conn_init = 1;
588 } 589 }
589 fuse_put_request(fc, req); 590 fuse_put_request(fc, req);
@@ -658,7 +659,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
658 fc->flags = d.flags; 659 fc->flags = d.flags;
659 fc->user_id = d.user_id; 660 fc->user_id = d.user_id;
660 fc->group_id = d.group_id; 661 fc->group_id = d.group_id;
661 fc->max_read = d.max_read; 662 fc->max_read = min_t(unsigned, 4096, d.max_read);
662 663
663 /* Used by get_root_inode() */ 664 /* Used by get_root_inode() */
664 sb->s_fs_info = fc; 665 sb->s_fs_info = fc;