Commit fb05f41f5f96f7423c53da4d87913fb44fd0565d
1 parent
5565a9d884
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
fuse: cleanup fuse_direct_io()
Fix the following sparse warnings: fs/fuse/file.c:1216:43: warning: cast removes address space of expression fs/fuse/file.c:1216:43: warning: incorrect type in initializer (different address spaces) fs/fuse/file.c:1216:43: expected void [noderef] <asn:1>*iov_base fs/fuse/file.c:1216:43: got void *<noident> fs/fuse/file.c:1241:43: warning: cast removes address space of expression fs/fuse/file.c:1241:43: warning: incorrect type in initializer (different address spaces) fs/fuse/file.c:1241:43: expected void [noderef] <asn:1>*iov_base fs/fuse/file.c:1241:43: got void *<noident> fs/fuse/file.c:1267:43: warning: cast removes address space of expression fs/fuse/file.c:1267:43: warning: incorrect type in initializer (different address spaces) fs/fuse/file.c:1267:43: expected void [noderef] <asn:1>*iov_base fs/fuse/file.c:1267:43: got void *<noident> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Showing 3 changed files with 16 additions and 19 deletions Side-by-side Diff
fs/fuse/cuse.c
... | ... | @@ -91,19 +91,22 @@ |
91 | 91 | loff_t *ppos) |
92 | 92 | { |
93 | 93 | loff_t pos = 0; |
94 | + struct iovec iov = { .iov_base = buf, .iov_len = count }; | |
94 | 95 | |
95 | - return fuse_direct_io(file, buf, count, &pos, 0); | |
96 | + return fuse_direct_io(file, &iov, 1, count, &pos, 0); | |
96 | 97 | } |
97 | 98 | |
98 | 99 | static ssize_t cuse_write(struct file *file, const char __user *buf, |
99 | 100 | size_t count, loff_t *ppos) |
100 | 101 | { |
101 | 102 | loff_t pos = 0; |
103 | + struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = count }; | |
104 | + | |
102 | 105 | /* |
103 | 106 | * No locking or generic_write_checks(), the server is |
104 | 107 | * responsible for locking and sanity checks. |
105 | 108 | */ |
106 | - return fuse_direct_io(file, buf, count, &pos, 1); | |
109 | + return fuse_direct_io(file, &iov, 1, count, &pos, 1); | |
107 | 110 | } |
108 | 111 | |
109 | 112 | static int cuse_open(struct inode *inode, struct file *file) |
fs/fuse/file.c
... | ... | @@ -1148,9 +1148,9 @@ |
1148 | 1148 | return min(npages, FUSE_MAX_PAGES_PER_REQ); |
1149 | 1149 | } |
1150 | 1150 | |
1151 | -static ssize_t __fuse_direct_io(struct file *file, const struct iovec *iov, | |
1152 | - unsigned long nr_segs, size_t count, | |
1153 | - loff_t *ppos, int write) | |
1151 | +ssize_t fuse_direct_io(struct file *file, const struct iovec *iov, | |
1152 | + unsigned long nr_segs, size_t count, loff_t *ppos, | |
1153 | + int write) | |
1154 | 1154 | { |
1155 | 1155 | struct fuse_file *ff = file->private_data; |
1156 | 1156 | struct fuse_conn *fc = ff->fc; |
... | ... | @@ -1209,13 +1209,6 @@ |
1209 | 1209 | |
1210 | 1210 | return res; |
1211 | 1211 | } |
1212 | - | |
1213 | -ssize_t fuse_direct_io(struct file *file, const char __user *buf, | |
1214 | - size_t count, loff_t *ppos, int write) | |
1215 | -{ | |
1216 | - struct iovec iov = { .iov_base = (void *)buf, .iov_len = count }; | |
1217 | - return __fuse_direct_io(file, &iov, 1, count, ppos, write); | |
1218 | -} | |
1219 | 1212 | EXPORT_SYMBOL_GPL(fuse_direct_io); |
1220 | 1213 | |
1221 | 1214 | static ssize_t __fuse_direct_read(struct file *file, const struct iovec *iov, |
... | ... | @@ -1227,8 +1220,8 @@ |
1227 | 1220 | if (is_bad_inode(inode)) |
1228 | 1221 | return -EIO; |
1229 | 1222 | |
1230 | - res = __fuse_direct_io(file, iov, nr_segs, iov_length(iov, nr_segs), | |
1231 | - ppos, 0); | |
1223 | + res = fuse_direct_io(file, iov, nr_segs, iov_length(iov, nr_segs), | |
1224 | + ppos, 0); | |
1232 | 1225 | |
1233 | 1226 | fuse_invalidate_attr(inode); |
1234 | 1227 | |
... | ... | @@ -1238,7 +1231,7 @@ |
1238 | 1231 | static ssize_t fuse_direct_read(struct file *file, char __user *buf, |
1239 | 1232 | size_t count, loff_t *ppos) |
1240 | 1233 | { |
1241 | - struct iovec iov = { .iov_base = (void *)buf, .iov_len = count }; | |
1234 | + struct iovec iov = { .iov_base = buf, .iov_len = count }; | |
1242 | 1235 | return __fuse_direct_read(file, &iov, 1, ppos); |
1243 | 1236 | } |
1244 | 1237 | |
... | ... | @@ -1251,7 +1244,7 @@ |
1251 | 1244 | |
1252 | 1245 | res = generic_write_checks(file, ppos, &count, 0); |
1253 | 1246 | if (!res) { |
1254 | - res = __fuse_direct_io(file, iov, nr_segs, count, ppos, 1); | |
1247 | + res = fuse_direct_io(file, iov, nr_segs, count, ppos, 1); | |
1255 | 1248 | if (res > 0) |
1256 | 1249 | fuse_write_update_size(inode, *ppos); |
1257 | 1250 | } |
... | ... | @@ -1264,7 +1257,7 @@ |
1264 | 1257 | static ssize_t fuse_direct_write(struct file *file, const char __user *buf, |
1265 | 1258 | size_t count, loff_t *ppos) |
1266 | 1259 | { |
1267 | - struct iovec iov = { .iov_base = (void *)buf, .iov_len = count }; | |
1260 | + struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = count }; | |
1268 | 1261 | struct inode *inode = file->f_path.dentry->d_inode; |
1269 | 1262 | ssize_t res; |
1270 | 1263 |
fs/fuse/fuse_i.h
... | ... | @@ -811,8 +811,9 @@ |
811 | 811 | |
812 | 812 | int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file, |
813 | 813 | bool isdir); |
814 | -ssize_t fuse_direct_io(struct file *file, const char __user *buf, | |
815 | - size_t count, loff_t *ppos, int write); | |
814 | +ssize_t fuse_direct_io(struct file *file, const struct iovec *iov, | |
815 | + unsigned long nr_segs, size_t count, loff_t *ppos, | |
816 | + int write); | |
816 | 817 | long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, |
817 | 818 | unsigned int flags); |
818 | 819 | long fuse_ioctl_common(struct file *file, unsigned int cmd, |