diff --git a/sys/kern/subr_uio.c b/sys/kern/subr_uio.c index 62e9bacadf9a..5d98e8fbc69f 100644 --- a/sys/kern/subr_uio.c +++ b/sys/kern/subr_uio.c @@ -212,7 +212,7 @@ uiomove_faultflag(void *cp, int n, struct uio *uio, int nofault) size_t cnt; int error, newflags, save; - error = 0; + save = error = 0; KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, ("uiomove: mode")); @@ -275,7 +275,7 @@ uiomove_faultflag(void *cp, int n, struct uio *uio, int nofault) n -= cnt; } out: - if (uio->uio_segflg == UIO_USERSPACE) + if (save) curthread_pflags_restore(save); return (error); }