[patch V2 6/6] select: Convert to scoped masked user access
Thomas Gleixner
tglx at linutronix.de
Tue Sep 16 09:33:19 PDT 2025
From: Thomas Gleixner <tglx at linutronix.de>
Replace the open coded implementation with the scoped masked user access
mechanism.
No functional change intended.
Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
Cc: Alexander Viro <viro at zeniv.linux.org.uk>
Cc: Christian Brauner <brauner at kernel.org>
Cc: Jan Kara <jack at suse.cz>
Cc: linux-fsdevel at vger.kernel.org
---
fs/select.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
---
--- a/fs/select.c
+++ b/fs/select.c
@@ -776,18 +776,12 @@ static inline int get_sigset_argpack(str
{
// the path is hot enough for overhead of copy_from_user() to matter
if (from) {
- if (can_do_masked_user_access())
- from = masked_user_access_begin(from);
- else if (!user_read_access_begin(from, sizeof(*from)))
- return -EFAULT;
- unsafe_get_user(to->p, &from->p, Efault);
- unsafe_get_user(to->size, &from->size, Efault);
- user_read_access_end();
+ scoped_masked_user_rw_access(from, return -EFAULT, {
+ scoped_get_user(to->p, &from->p);
+ scoped_get_user(to->size, &from->size);
+ });
}
return 0;
-Efault:
- user_read_access_end();
- return -EFAULT;
}
SYSCALL_DEFINE6(pselect6, int, n, fd_set __user *, inp, fd_set __user *, outp,
More information about the linux-arm-kernel
mailing list