]> git.hungrycats.org Git - linux/commit
[PATCH] sparse: read_descriptor_t annotation
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>
Wed, 14 Jul 2004 02:37:04 +0000 (19:37 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 14 Jul 2004 02:37:04 +0000 (19:37 -0700)
commit790d43fd412fbb30bfb61504250e88ece790f485
treed129747d615470a10c45d2ada3386f593e66b5dd
parentc659d1a85a24500b775390a0d5f6a2fe06d6cbf4
[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 *.
drivers/block/loop.c
fs/nfs/file.c
fs/nfsd/vfs.c
fs/smbfs/file.c
include/linux/fs.h
mm/filemap.c
mm/shmem.c
net/sunrpc/xprt.c