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

Peter Zijlstra peterz at infradead.org
Thu Oct 23 01:23:59 AEDT 2025


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. 


More information about the Linuxppc-dev mailing list