aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/sys_generic.c
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2002-05-09 02:30:41 +0000
committerAlan Cox <alc@FreeBSD.org>2002-05-09 02:30:41 +0000
commit82641acd1761e7ad87470a3fcca4ec5731f4b1de (patch)
treeb17dd197ca2c975298d9ef4adb1530ee6962951f /sys/kern/sys_generic.c
parent3393d027da02c744b0fb655e52ad3b3363aa06a8 (diff)
downloadsrc-82641acd1761e7ad87470a3fcca4ec5731f4b1de.tar.gz
src-82641acd1761e7ad87470a3fcca4ec5731f4b1de.zip
Notes
Diffstat (limited to 'sys/kern/sys_generic.c')
-rw-r--r--sys/kern/sys_generic.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 66ee8915ea83..f3352b91acfe 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -232,29 +232,28 @@ readv(td, uap)
struct iovec *iov;
struct iovec *needfree;
struct iovec aiov[UIO_SMALLIOV];
- long i, cnt, error = 0;
+ long i, cnt;
+ int error;
u_int iovlen;
#ifdef KTRACE
struct iovec *ktriov = NULL;
struct uio ktruio;
#endif
- mtx_lock(&Giant);
if ((error = fget_read(td, uap->fd, &fp)) != 0)
- goto done2;
+ return (error);
+ needfree = NULL;
/* note: can't use iovlen until iovcnt is validated */
iovlen = uap->iovcnt * sizeof (struct iovec);
if (uap->iovcnt > UIO_SMALLIOV) {
if (uap->iovcnt > UIO_MAXIOV) {
error = EINVAL;
- goto done2;
+ goto done;
}
MALLOC(iov, struct iovec *, iovlen, M_IOV, M_WAITOK);
needfree = iov;
- } else {
+ } else
iov = aiov;
- needfree = NULL;
- }
auio.uio_iov = iov;
auio.uio_iovcnt = uap->iovcnt;
auio.uio_rw = UIO_READ;
@@ -305,8 +304,6 @@ done:
fdrop(fp, td);
if (needfree)
FREE(needfree, M_IOV);
-done2:
- mtx_unlock(&Giant);
return (error);
}