From: David Laight <david.laight.linux@gmail.com>
Wrappers for autoterminating nested for() loops have been added to
compiler.h, use them to hide the gory details.
Signed-off-by: David Laight <david.laight.linux@gmail.com>
---
include/linux/uaccess.h | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index c5d5f2d395bc..589cb2ef2e7b 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -751,12 +751,10 @@ USER_ACCESS_GUARD(rw, void)
* Don't use directly. Use scoped_masked_user_$MODE_access() instead.
*/
#define __scoped_user_access(mode, uptr, size, elbl) \
-for (bool done = false; !done; done = true) \
- for (typeof(uptr) _tmpptr = __scoped_user_access_begin(mode, uptr, size, elbl); \
- !done; done = true) \
- for (CLASS(user_##mode##_access, scope)(_tmpptr); !done; done = true) \
- /* Force modified pointer usage within the scope */ \
- for (const typeof(uptr) uptr = _tmpptr; !done; done = true)
+ with (typeof(uptr) _tmpptr = __scoped_user_access_begin(mode, uptr, size, elbl)) \
+ and_with (CLASS(user_##mode##_access, scope)(_tmpptr)) \
+ /* Force modified pointer usage within the scope */ \
+ and_with (const typeof(uptr) uptr = _tmpptr)
/**
* scoped_user_read_access_size - Start a scoped user read access with given size
--
2.39.5