diff options
Diffstat (limited to 'lib/usercopy.c')
| -rw-r--r-- | lib/usercopy.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/lib/usercopy.c b/lib/usercopy.c index 7413dd300516..b00a3a957de6 100644 --- a/lib/usercopy.c +++ b/lib/usercopy.c @@ -1,38 +1,29 @@ // SPDX-License-Identifier: GPL-2.0 -#include <linux/bitops.h> +#include <linux/compiler.h> +#include <linux/errno.h> +#include <linux/export.h> #include <linux/fault-inject-usercopy.h> #include <linux/instrumented.h> +#include <linux/kernel.h> +#include <linux/nospec.h> +#include <linux/string.h> #include <linux/uaccess.h> +#include <linux/wordpart.h> /* out-of-line parts */ -#ifndef INLINE_COPY_FROM_USER +#if !defined(INLINE_COPY_FROM_USER) unsigned long _copy_from_user(void *to, const void __user *from, unsigned long n) { - unsigned long res = n; - might_fault(); - if (!should_fail_usercopy() && likely(access_ok(from, n))) { - instrument_copy_from_user(to, from, n); - res = raw_copy_from_user(to, from, n); - } - if (unlikely(res)) - memset(to + (n - res), 0, res); - return res; + return _inline_copy_from_user(to, from, n); } EXPORT_SYMBOL(_copy_from_user); #endif -#ifndef INLINE_COPY_TO_USER +#if !defined(INLINE_COPY_TO_USER) unsigned long _copy_to_user(void __user *to, const void *from, unsigned long n) { - might_fault(); - if (should_fail_usercopy()) - return n; - if (likely(access_ok(to, n))) { - instrument_copy_to_user(to, from, n); - n = raw_copy_to_user(to, from, n); - } - return n; + return _inline_copy_to_user(to, from, n); } EXPORT_SYMBOL(_copy_to_user); #endif |
