diff --git a/sys/kern/kern_xio.c b/sys/kern/kern_xio.c --- a/sys/kern/kern_xio.c +++ b/sys/kern/kern_xio.c @@ -199,10 +199,11 @@ size_t bytes; int error; + if (uoffset < 0 || (size_t)uoffset > xio->xio_bytes) + return(EFAULT); bytes = xio->xio_bytes - uoffset; if (bytes > uio->uio_resid) bytes = uio->uio_resid; - KKASSERT(bytes >= 0); error = uiomove_fromphys(xio->xio_pages, xio->xio_offset + uoffset, bytes, uio); if (error == 0)