From: David Laight <david.laight.linux@gmail.com>
Converting kernel/signal.c to use scoped_user_access() had compilation
warnings because some of the pointers are 'pointer to const'.
This is fixed in patch 1.
Patches 2 and 3 factor out the 'autoterminating nested for loops'.
I'm sure there'll be a 'bikeshed' discussion about the names.
I think the two 'typeof(uptr)' could be 'auto', compiles for me
but IIRC there are issues with old compilers.
Patch 4 stops warnings from -Wshadow (enabled by W=2).
I did think about making the _diag_xxx conditional on a W=2 build,
but since the pre-processor just emits #pragma lines and they are
smaller that the for() loop it doesn't seem worth while.
Patch 5 is the change to signal.c that prompted patch 1.
The generated code looks fine, but I've not tested it.
Most of the changes are to 'compat' code - so are probably not
usually performance critical.
IIRC the non-compat code uses copy_to/from_user() for the structures
so is probably slower than the compat code's member by member copy.
David Laight (5):
uaccess: Fix scoped_user_read_access() for 'pointer to const'
compiler.h: Add generic support for 'autoterminating nested for()
loops'
uaccess.h: Use with() and and_with() in __scoped_user_access()
uaccess: Disable -Wshadow in __scoped_user_access()
signal: Use scoped_user_access() instead of __put/get_user()
include/linux/compiler.h | 26 +++++++++++++++
include/linux/uaccess.h | 32 +++++++++---------
kernel/signal.c | 72 +++++++++++++++++++++++-----------------
3 files changed, 84 insertions(+), 46 deletions(-)
--
2.39.5