On Tue, Jun 23, 2026 at 02:42:17PM +0000, Konstantin Belousov wrote:
> The branch main has been updated by kib:
> 
> URL: 
> https://cgit.FreeBSD.org/src/commit/?id=4c419570024951ad1e477c8d6c3d9968199faf4a
> 
> commit 4c419570024951ad1e477c8d6c3d9968199faf4a
> Author:     Konstantin Belousov <[email protected]>
> AuthorDate: 2026-06-21 18:48:06 +0000
> Commit:     Konstantin Belousov <[email protected]>
> CommitDate: 2026-06-23 14:42:03 +0000
> 
>     sys: use curthread_pflags_set/restore to manage TDP_DEADLKTREAT for uio
>     
>     For i386, remove now unused label.
>     Remove unneeded initialization of the 'save' local.
>     
>     Reviewed bu:    brooks
>     Sponsored by:   The FreeBSD Foundation
>     MFC after:      1 week
>     Differential revision:  https://reviews.freebsd.org/D57726
> [...]
> diff --git a/sys/kern/subr_uio.c b/sys/kern/subr_uio.c
> index fea1395a7f77..7e492d8aa705 100644
> --- a/sys/kern/subr_uio.c
> +++ b/sys/kern/subr_uio.c
> @@ -241,7 +241,7 @@ uiomove_faultflag(void *cp, int n, struct uio *uio, int 
> nofault)
>       size_t cnt;
>       int error, newflags, save;
>  
> -     save = error = 0;
> +     error = 0;
>  
>       KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE,
>           ("uiomove: mode"));
> @@ -264,6 +264,7 @@ uiomove_faultflag(void *cp, int n, struct uio *uio, int 
> nofault)
>               save = curthread_pflags_set(newflags);
>       } else {
>               KASSERT(nofault == 0, ("uiomove: nofault"));
> +             save = 0;

curthread_pflags_restore(0) clears all of curthread->td_pflags.  I guess
the proper initial value is ~0.

>       }
>  
>       while (n > 0 && uio->uio_resid) {
> @@ -291,8 +292,7 @@ uiomove_faultflag(void *cp, int n, struct uio *uio, int 
> nofault)
>               n -= cnt;
>       }
>  out:
> -     if (save)
> -             curthread_pflags_restore(save);
> +     curthread_pflags_restore(save);
>       return (error);
>  }

Reply via email to