summaryrefslogtreecommitdiff
path: root/sys/kern/sys_generic.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-07-28 00:13:59 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-07-28 00:13:59 +0000
commit70ac9fcbf4cbec8e4d581e0b0f8b229456a5a517 (patch)
treeb442ce56b4b49eb012118536460cb63905d9fb20 /sys/kern/sys_generic.c
parent7308bbe616f2495a440fa39e81d63067dad625ad (diff)
Return EINVAL when msg_iovlen or iovcnt <= 0; Make uio_resid unsigned (size_t) and don't return EINVAL if it is < 0 in sys_{read,write}. Remove check for uio_resid < 0 uiomove() now that uio_resid is unsigned and brack remaining panics with #ifdef DIAGNOSTIC. vn_rdwr() must now take a size_t * as its 9th argument so change that and clean up uses of vn_rdwr(). Fixes 549 + more
Diffstat (limited to 'sys/kern/sys_generic.c')
-rw-r--r--sys/kern/sys_generic.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 1603e9e4595..fb6cf718aef 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_generic.c,v 1.12 1998/02/09 06:29:07 tholo Exp $ */
+/* $OpenBSD: sys_generic.c,v 1.13 1998/07/28 00:12:58 millert Exp $ */
/* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */
/*
@@ -102,8 +102,6 @@ sys_read(p, v, retval)
auio.uio_rw = UIO_READ;
auio.uio_segflg = UIO_USERSPACE;
auio.uio_procp = p;
- if (auio.uio_resid < 0)
- return EINVAL;
#ifdef KTRACE
/*
* if tracing, save a copy of iovec
@@ -157,6 +155,8 @@ sys_readv(p, v, retval)
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL ||
(fp->f_flag & FREAD) == 0)
return (EBADF);
+ if (SCARG(uap, iovcnt) <= 0)
+ return (EINVAL);
/* note: can't use iovlen until iovcnt is validated */
iovlen = SCARG(uap, iovcnt) * sizeof (struct iovec);
if (SCARG(uap, iovcnt) > UIO_SMALLIOV) {
@@ -252,8 +252,6 @@ sys_write(p, v, retval)
auio.uio_rw = UIO_WRITE;
auio.uio_segflg = UIO_USERSPACE;
auio.uio_procp = p;
- if (auio.uio_resid < 0)
- return EINVAL;
#ifdef KTRACE
/*
* if tracing, save a copy of iovec
@@ -310,6 +308,8 @@ sys_writev(p, v, retval)
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL ||
(fp->f_flag & FWRITE) == 0)
return (EBADF);
+ if (SCARG(uap, iovcnt) <= 0)
+ return (EINVAL);
/* note: can't use iovlen until iovcnt is validated */
iovlen = SCARG(uap, iovcnt) * sizeof (struct iovec);
if (SCARG(uap, iovcnt) > UIO_SMALLIOV) {