new helper: uaccess_kernel()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2017-03-20 21:08:07 -04:00
parent aaa2e7ac80
commit db68ce10c4
32 changed files with 44 additions and 42 deletions

View file

@ -90,7 +90,7 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n)
unsigned long ua_flags;
int atomic;
if (unlikely(segment_eq(get_fs(), KERNEL_DS))) {
if (uaccess_kernel()) {
memcpy((void *)to, from, n);
return 0;
}
@ -162,7 +162,7 @@ __clear_user_memset(void __user *addr, unsigned long n)
{
unsigned long ua_flags;
if (unlikely(segment_eq(get_fs(), KERNEL_DS))) {
if (uaccess_kernel()) {
memset((void *)addr, 0, n);
return 0;
}