aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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 /fs
parentc659d1a85a24500b775390a0d5f6a2fe06d6cbf4 (diff)
downloadhistory-790d43fd412fbb30bfb61504250e88ece790f485.tar.gz
[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 'fs')
-rw-r--r--fs/nfs/file.c4
-rw-r--r--fs/nfsd/vfs.c2
-rw-r--r--fs/smbfs/file.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 1ea93c580a03f8..02deae074c6f54 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -38,7 +38,7 @@ static long nfs_file_fcntl(int fd, unsigned int cmd,
static int nfs_file_open(struct inode *, struct file *);
static int nfs_file_release(struct inode *, struct file *);
static int nfs_file_mmap(struct file *, struct vm_area_struct *);
-static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void __user *);
+static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *);
static ssize_t nfs_file_read(struct kiocb *, char __user *, size_t, loff_t);
static ssize_t nfs_file_write(struct kiocb *, const char __user *, size_t, loff_t);
static int nfs_file_flush(struct file *);
@@ -171,7 +171,7 @@ nfs_file_read(struct kiocb *iocb, char __user * buf, size_t count, loff_t pos)
static ssize_t
nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count,
- read_actor_t actor, void __user *target)
+ read_actor_t actor, void *target)
{
struct dentry *dentry = filp->f_dentry;
struct inode *inode = dentry->d_inode;
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index f7ac90d1596167..a6a05c3b247cba 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -611,7 +611,7 @@ static int
nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset , unsigned long size)
{
unsigned long count = desc->count;
- struct svc_rqst *rqstp = (struct svc_rqst *)desc->buf;
+ struct svc_rqst *rqstp = desc->arg.data;
if (size > count)
size = count;
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c
index b28f42e3bf08db..e97fc5807cab38 100644
--- a/fs/smbfs/file.c
+++ b/fs/smbfs/file.c
@@ -261,7 +261,7 @@ out:
static ssize_t
smb_file_sendfile(struct file *file, loff_t *ppos,
- size_t count, read_actor_t actor, void __user *target)
+ size_t count, read_actor_t actor, void *target)
{
struct dentry *dentry = file->f_dentry;
ssize_t status;