From 526d0bd547574b185147f03c13e2db7abe566a08 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 21 Feb 2012 01:05:12 +0000 Subject: Fix found places where uio_resid is truncated to int. Add the sysctl debug.iosize_max_clamp, enabled by default. Setting the sysctl to zero allows to perform the SSIZE_MAX-sized i/o requests from the usermode. Discussed with: bde, das (previous versions) MFC after: 1 month --- sys/kern/uipc_socket.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'sys/kern/uipc_socket.c') diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 91309deeee55..d11e87067900 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -887,7 +887,8 @@ sosend_copyin(struct uio *uio, struct mbuf **retmp, int atomic, long *space, int flags) { struct mbuf *m, **mp, *top; - long len, resid; + long len; + ssize_t resid; int error; #ifdef ZERO_COPY_SOCKETS int cow_send; @@ -987,7 +988,8 @@ int sosend_dgram(struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td) { - long space, resid; + long space; + ssize_t resid; int clen = 0, error, dontroute; #ifdef ZERO_COPY_SOCKETS int atomic = sosendallatonce(so) || top; @@ -1159,7 +1161,8 @@ int sosend_generic(struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td) { - long space, resid; + long space; + ssize_t resid; int clen = 0, error, dontroute; int atomic = sosendallatonce(so) || top; @@ -1456,11 +1459,12 @@ soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp) { struct mbuf *m, **mp; - int flags, len, error, offset; + int flags, error, offset; + ssize_t len; struct protosw *pr = so->so_proto; struct mbuf *nextrecord; int moff, type = 0; - int orig_resid = uio->uio_resid; + ssize_t orig_resid = uio->uio_resid; mp = mp0; if (psa != NULL) @@ -2119,7 +2123,8 @@ soreceive_dgram(struct socket *so, struct sockaddr **psa, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp) { struct mbuf *m, *m2; - int flags, len, error; + int flags, error; + ssize_t len; struct protosw *pr = so->so_proto; struct mbuf *nextrecord; -- cgit v1.2.3