Merge tag 'chrome-platform-for-linus-4.13' of git://git.kernel.org/pub/scm/linux...
[linux/fpc-iii.git] / arch / x86 / lib / usercopy.c
blobc8c6ad0d58b89c3621d0fcf11f45e00442ebf2a2
1 /*
2 * User address space access functions.
4 * For licencing details see kernel-base/COPYING
5 */
7 #include <linux/uaccess.h>
8 #include <linux/export.h>
11 * We rely on the nested NMI work to allow atomic faults from the NMI path; the
12 * nested NMI paths are careful to preserve CR2.
14 unsigned long
15 copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
17 unsigned long ret;
19 if (__range_not_ok(from, n, TASK_SIZE))
20 return n;
23 * Even though this function is typically called from NMI/IRQ context
24 * disable pagefaults so that its behaviour is consistent even when
25 * called form other contexts.
27 pagefault_disable();
28 ret = __copy_from_user_inatomic(to, from, n);
29 pagefault_enable();
31 return ret;
33 EXPORT_SYMBOL_GPL(copy_from_user_nmi);