diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_ktrace.c | 29 | ||||
-rw-r--r-- | sys/kern/kern_subr.c | 10 | ||||
-rw-r--r-- | sys/kern/sys_generic.c | 7 | ||||
-rw-r--r-- | sys/kern/uipc_syscalls.c | 7 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 4 | ||||
-rw-r--r-- | sys/msdosfs/msdosfs_vnops.c | 4 | ||||
-rw-r--r-- | sys/nfs/nfs_bio.c | 4 | ||||
-rw-r--r-- | sys/sys/ktrace.h | 4 | ||||
-rw-r--r-- | sys/sys/vnode.h | 4 | ||||
-rw-r--r-- | sys/ufs/ext2fs/ext2fs_readwrite.c | 5 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vnops.c | 6 |
11 files changed, 41 insertions, 43 deletions
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 7eb25f0498a..50e29d13398 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_ktrace.c,v 1.60 2013/06/01 16:27:37 tedu Exp $ */ +/* $OpenBSD: kern_ktrace.c,v 1.61 2013/09/14 02:28:01 guenther Exp $ */ /* $NetBSD: kern_ktrace.c,v 1.23 1996/02/09 18:59:36 christos Exp $ */ /* @@ -159,7 +159,7 @@ ktrsyscall(struct proc *p, register_t code, size_t argsize, register_t args[]) * array because it is interesting. */ if (args[1] > 0) - nargs = min(args[1], CTL_MAXNAME); + nargs = lmin(args[1], CTL_MAXNAME); len += nargs * sizeof(int); } atomic_setbits_int(&p->p_flag, P_INKTR); @@ -225,21 +225,22 @@ ktremul(struct proc *p, char *emul) } void -ktrgenio(struct proc *p, int fd, enum uio_rw rw, struct iovec *iov, int len, - int error) +ktrgenio(struct proc *p, int fd, enum uio_rw rw, struct iovec *iov, + ssize_t len) { struct ktr_header kth; struct ktr_genio *ktp; caddr_t cp; - int resid = len, count; + int count; int buflen; - if (error) - return; - atomic_setbits_int(&p->p_flag, P_INKTR); - buflen = min(PAGE_SIZE, len + sizeof(struct ktr_genio)); + /* beware overflow */ + if (len > PAGE_SIZE - sizeof(struct ktr_genio)) + buflen = PAGE_SIZE; + else + buflen = len + sizeof(struct ktr_genio); ktrinitheader(&kth, p, KTR_GENIO); ktp = malloc(buflen, M_TEMP, M_WAITOK); @@ -249,7 +250,7 @@ ktrgenio(struct proc *p, int fd, enum uio_rw rw, struct iovec *iov, int len, cp = (caddr_t)((char *)ktp + sizeof (struct ktr_genio)); buflen -= sizeof(struct ktr_genio); - while (resid > 0) { + while (len > 0) { /* * Don't allow this process to hog the cpu when doing * huge I/O. @@ -257,9 +258,9 @@ ktrgenio(struct proc *p, int fd, enum uio_rw rw, struct iovec *iov, int len, if (curcpu()->ci_schedstate.spc_schedflags & SPCF_SHOULDYIELD) preempt(NULL); - count = min(iov->iov_len, buflen); - if (count > resid) - count = resid; + count = lmin(iov->iov_len, buflen); + if (count > len) + count = len; if (copyin(iov->iov_base, cp, count)) break; @@ -274,7 +275,7 @@ ktrgenio(struct proc *p, int fd, enum uio_rw rw, struct iovec *iov, int len, if (iov->iov_len == 0) iov++; - resid -= count; + len -= count; } free(ktp, M_TEMP); diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index 5ebbde0f4a5..16310190e47 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_subr.c,v 1.35 2013/08/13 05:52:23 guenther Exp $ */ +/* $OpenBSD: kern_subr.c,v 1.36 2013/09/14 02:28:01 guenther Exp $ */ /* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */ /* @@ -50,7 +50,7 @@ int uiomove(void *cp, int n, struct uio *uio) { struct iovec *iov; - u_int cnt; + size_t cnt; int error = 0; struct proc *p; @@ -72,9 +72,8 @@ uiomove(void *cp, int n, struct uio *uio) } if (cnt > n) cnt = n; - switch ((int)uio->uio_segflg) { + switch (uio->uio_segflg) { - case UIO_USERSPACE | 0x10: case UIO_USERSPACE: if (curcpu()->ci_schedstate.spc_schedflags & SPCF_SHOULDYIELD) @@ -132,9 +131,8 @@ again: uio->uio_iov++; goto again; } - switch ((int)uio->uio_segflg) { + switch (uio->uio_segflg) { - case UIO_USERSPACE | 0x10: case UIO_USERSPACE: { char tmp = c; diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 92a615f2d56..f02b6cafac6 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_generic.c,v 1.83 2013/09/14 01:35:01 guenther Exp $ */ +/* $OpenBSD: sys_generic.c,v 1.84 2013/09/14 02:28:02 guenther Exp $ */ /* $NetBSD: sys_generic.c,v 1.24 1996/03/29 00:25:32 cgd Exp $ */ /* @@ -211,8 +211,7 @@ dofilereadv(struct proc *p, int fd, struct file *fp, const struct iovec *iovp, #ifdef KTRACE if (ktriov != NULL) { if (error == 0) - ktrgenio(p, fd, UIO_READ, ktriov, cnt, - error); + ktrgenio(p, fd, UIO_READ, ktriov, cnt); free(ktriov, M_TEMP); } #endif @@ -368,7 +367,7 @@ dofilewritev(struct proc *p, int fd, struct file *fp, const struct iovec *iovp, #ifdef KTRACE if (ktriov != NULL) { if (error == 0) - ktrgenio(p, fd, UIO_WRITE, ktriov, cnt, error); + ktrgenio(p, fd, UIO_WRITE, ktriov, cnt); free(ktriov, M_TEMP); } #endif diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 3d54ed0a1c1..5ff3bef35a1 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.88 2013/04/05 08:25:30 tedu Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.89 2013/09/14 02:28:02 guenther Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -538,7 +538,7 @@ sendit(struct proc *p, int s, struct msghdr *mp, int flags, register_t *retsize) #ifdef KTRACE if (ktriov != NULL) { if (error == 0) - ktrgenio(p, s, UIO_WRITE, ktriov, *retsize, error); + ktrgenio(p, s, UIO_WRITE, ktriov, *retsize); free(ktriov, M_TEMP); } #endif @@ -677,8 +677,7 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp, #ifdef KTRACE if (ktriov != NULL) { if (error == 0) - ktrgenio(p, s, UIO_READ, ktriov, - len - auio.uio_resid, error); + ktrgenio(p, s, UIO_READ, ktriov, len - auio.uio_resid); free(ktriov, M_TEMP); } #endif diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 19302ba5e2c..e00ebf8bbbc 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.73 2013/06/05 01:26:00 guenther Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.74 2013/09/14 02:28:01 guenther Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -232,7 +232,7 @@ vn_writechk(struct vnode *vp) * via the 'overrun' argument. */ int -vn_fsizechk(struct vnode *vp, struct uio *uio, int ioflag, int *overrun) +vn_fsizechk(struct vnode *vp, struct uio *uio, int ioflag, ssize_t *overrun) { struct proc *p = uio->uio_procp; diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index 9d1bd021f26..23f61e343c9 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vnops.c,v 1.88 2013/08/13 05:52:24 guenther Exp $ */ +/* $OpenBSD: msdosfs_vnops.c,v 1.89 2013/09/14 02:28:03 guenther Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.63 1997/10/17 11:24:19 ws Exp $ */ /*- @@ -594,7 +594,7 @@ msdosfs_write(void *v) int n; int croffset; int resid; - int overrun; + ssize_t overrun; int extended = 0; uint32_t osize; int error = 0; diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index 3cef0c68153..ac815226f6f 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_bio.c,v 1.74 2013/06/11 16:42:17 deraadt Exp $ */ +/* $OpenBSD: nfs_bio.c,v 1.75 2013/09/14 02:28:03 guenther Exp $ */ /* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */ /* @@ -257,7 +257,7 @@ nfs_write(void *v) struct nfsmount *nmp = VFSTONFS(vp->v_mount); daddr_t lbn, bn; int n, on, error = 0, extended = 0, wrotedta = 0, truncated = 0; - int overrun; + ssize_t overrun; #ifdef DIAGNOSTIC if (uio->uio_rw != UIO_WRITE) diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h index f8bb063829c..4f4b3c6055c 100644 --- a/sys/sys/ktrace.h +++ b/sys/sys/ktrace.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ktrace.h,v 1.16 2013/06/01 09:49:52 miod Exp $ */ +/* $OpenBSD: ktrace.h,v 1.17 2013/09/14 02:28:02 guenther Exp $ */ /* $NetBSD: ktrace.h,v 1.12 1996/02/04 02:12:29 christos Exp $ */ /* @@ -196,7 +196,7 @@ __END_DECLS void ktrcsw(struct proc *, int, int); void ktremul(struct proc *, char *); -void ktrgenio(struct proc *, int, enum uio_rw, struct iovec *, int, int); +void ktrgenio(struct proc *, int, enum uio_rw, struct iovec *, ssize_t); void ktrnamei(struct proc *, char *); void ktrpsig(struct proc *, int, sig_t, int, int, siginfo_t *); void ktrsyscall(struct proc *, register_t, size_t, register_t []); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 6f347ff1832..2f97a852f35 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vnode.h,v 1.119 2013/08/13 05:52:27 guenther Exp $ */ +/* $OpenBSD: vnode.h,v 1.120 2013/09/14 02:28:02 guenther Exp $ */ /* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */ /* @@ -649,7 +649,7 @@ int vn_stat(struct vnode *, struct stat *, struct proc *); int vn_statfile(struct file *, struct stat *, struct proc *); int vn_lock(struct vnode *, int, struct proc *); int vn_writechk(struct vnode *); -int vn_fsizechk(struct vnode *, struct uio *, int, int *); +int vn_fsizechk(struct vnode *, struct uio *, int, ssize_t *); int vn_ioctl(struct file *, u_long, caddr_t, struct proc *); void vn_marktext(struct vnode *); diff --git a/sys/ufs/ext2fs/ext2fs_readwrite.c b/sys/ufs/ext2fs/ext2fs_readwrite.c index fe05a011116..60d1dea1509 100644 --- a/sys/ufs/ext2fs/ext2fs_readwrite.c +++ b/sys/ufs/ext2fs/ext2fs_readwrite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_readwrite.c,v 1.25 2013/06/11 16:42:18 deraadt Exp $ */ +/* $OpenBSD: ext2fs_readwrite.c,v 1.26 2013/09/14 02:28:03 guenther Exp $ */ /* $NetBSD: ext2fs_readwrite.c,v 1.16 2001/02/27 04:37:47 chs Exp $ */ /*- @@ -164,7 +164,8 @@ ext2fs_write(void *v) struct buf *bp; int32_t lbn; off_t osize; - int blkoffset, error, flags, ioflag, resid, size, xfersize, overrun; + int blkoffset, error, flags, ioflag, size, xfersize; + ssize_t resid, overrun; ioflag = ap->a_ioflag; uio = ap->a_uio; diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 6cbdf6f0b5d..04f1af4b91d 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vnops.c,v 1.71 2013/06/11 16:42:18 deraadt Exp $ */ +/* $OpenBSD: ffs_vnops.c,v 1.72 2013/09/14 02:28:02 guenther Exp $ */ /* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */ /* @@ -297,8 +297,8 @@ ffs_write(void *v) struct buf *bp; daddr_t lbn; off_t osize; - int blkoffset, error, extended, flags, ioflag, resid, size, xfersize; - int overrun; + int blkoffset, error, extended, flags, ioflag, size, xfersize; + ssize_t resid, overrun; extended = 0; ioflag = ap->a_ioflag; |