Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[deliverable/linux.git] / arch / x86 / lib / usercopy.c
CommitLineData
1ac2e6ca
RR
1/*
2 * User address space access functions.
3 *
4 * For licencing details see kernel-base/COPYING
5 */
6
7#include <linux/highmem.h>
8#include <linux/module.h>
9
92ae03f2 10#include <asm/word-at-a-time.h>
db0dc75d 11#include <linux/sched.h>
92ae03f2 12
1ac2e6ca 13/*
e00b12e6
PZ
14 * We rely on the nested NMI work to allow atomic faults from the NMI path; the
15 * nested NMI paths are careful to preserve CR2.
1ac2e6ca
RR
16 */
17unsigned long
18copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
19{
e00b12e6 20 unsigned long ret;
1ac2e6ca 21
25f42985 22 if (__range_not_ok(from, n, TASK_SIZE))
ebf2d268 23 return n;
e00b12e6
PZ
24
25 /*
26 * Even though this function is typically called from NMI/IRQ context
27 * disable pagefaults so that its behaviour is consistent even when
28 * called form other contexts.
29 */
30 pagefault_disable();
31 ret = __copy_from_user_inatomic(to, from, n);
32 pagefault_enable();
33
0a196848 34 return ret;
1ac2e6ca
RR
35}
36EXPORT_SYMBOL_GPL(copy_from_user_nmi);
This page took 0.285056 seconds and 5 git commands to generate.