Re: [patch V4 07/12] uaccess: Provide scoped user access regions

Peter Zijlstra
2025-10-22T14:24:20Z

On Wed, Oct 22, 2025 at 03:20:06PM +0100, David Laight wrote:

> I think that 'feature' should be marked as a 'bug', consider code like:
> for (; len >= sizeof (*uaddr); uaddr++; len -= sizeof (*uaddr)) {
> scoped_user_read_access(uaddr, Efault) {
> int frag_len;
> unsafe_get_user(frag_len, &uaddr->len, Efault);
> if (!frag_len)
> break;
> ...
> }
> ...
> }
>

All the scoped_* () things are for loops. break is a valid way to
terminate them.