aboutsummaryrefslogtreecommitdiffstats
path: root/net
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 /net
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 'net')
-rw-r--r--net/sunrpc/xprt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index cf4cf02bc35ea2..5fbbe608b14f5c 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -973,7 +973,7 @@ static int
tcp_data_recv(read_descriptor_t *rd_desc, struct sk_buff *skb,
unsigned int offset, size_t len)
{
- struct rpc_xprt *xprt = (struct rpc_xprt *)rd_desc->buf;
+ struct rpc_xprt *xprt = rd_desc->arg.data;
skb_reader_t desc = {
.skb = skb,
.offset = offset,
@@ -1021,7 +1021,7 @@ static void tcp_data_ready(struct sock *sk, int bytes)
goto out;
/* We use rd_desc to pass struct xprt to tcp_data_recv */
- rd_desc.buf = (char *)xprt;
+ rd_desc.arg.data = xprt;
rd_desc.count = 65536;
tcp_read_sock(sk, &rd_desc, tcp_data_recv);
out: