summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>2004-07-13 19:37:04 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-07-13 19:37:04 -0700
commit790d43fd412fbb30bfb61504250e88ece790f485 (patch)
treed129747d615470a10c45d2ada3386f593e66b5dd /include
parentc659d1a85a24500b775390a0d5f6a2fe06d6cbf4 (diff)
[PATCH] sparse: read_descriptor_t annotation
We have a fun situation with read_descriptor_t - all its instances end up passed to some actor; these actors use desc->buf as their private data; there are 5 of them and they expect resp: struct lo_read_data * struct svc_rqst * struct file * struct rpc_xprt * char __user * IOW, there is no type safety whatsoever; the field is essentially untyped, we rely on the fact that actor is chosen by the same code that sets ->buf and expect it to put something of the right type there. Right now desc->buf is declared as char __user *. Moreover, the last argument of ->sendfile() (what should be stored in ->buf) is void __user *, even though it's actually _never_ a userland pointer. If nothing else, ->sendfile() should take void * instead; that alone removes a bunch of bogus warnings. I went further and replaced desc->buf with a union of void * and char __user *.
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3d24beb4ac36..819e67e3a95b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -852,7 +852,10 @@ struct block_device_operations {
typedef struct {
size_t written;
size_t count;
- char __user * buf;
+ union {
+ char __user * buf;
+ void *data;
+ } arg;
int error;
} read_descriptor_t;
@@ -883,7 +886,7 @@ struct file_operations {
int (*lock) (struct file *, int, struct file_lock *);
ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);
ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);
- ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void __user *);
+ ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);
ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
long (*fcntl)(int fd, unsigned int cmd,
@@ -1410,7 +1413,7 @@ extern ssize_t do_sync_read(struct file *filp, char __user *buf, size_t len, lof
extern ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos);
ssize_t generic_file_write_nolock(struct file *file, const struct iovec *iov,
unsigned long nr_segs, loff_t *ppos);
-extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void __user *);
+extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *);
extern void do_generic_mapping_read(struct address_space *mapping,
struct file_ra_state *, struct file *,
loff_t *, read_descriptor_t *, read_actor_t);