mirror of
https://github.com/torvalds/linux.git
synced 2024-12-02 17:11:33 +00:00
e683014c21
Historically a lot of these existed because we did not have a distinction between what was modular code and what was providing support to modules via EXPORT_SYMBOL and friends. That changed when we forked out support for the latter into the export.h file. This means we should be able to reduce the usage of module.h in code that is obj-y Makefile or bool Kconfig. The advantage in doing so is that module.h itself sources about 15 other headers; adding significantly to what we feed cpp, and it can obscure what headers we are effectively using. Since module.h was the source for init.h (for __init) and for export.h (for EXPORT_SYMBOL) we consider each obj-y/bool instance for the presence of either and replace as needed. Build testing revealed a couple implicit header usage issues that were fixed. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20160714001901.31603-5-paul.gortmaker@windriver.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
37 lines
837 B
C
37 lines
837 B
C
/*
|
|
* User address space access functions.
|
|
*
|
|
* For licencing details see kernel-base/COPYING
|
|
*/
|
|
|
|
#include <linux/highmem.h>
|
|
#include <linux/export.h>
|
|
|
|
#include <asm/word-at-a-time.h>
|
|
#include <linux/sched.h>
|
|
|
|
/*
|
|
* We rely on the nested NMI work to allow atomic faults from the NMI path; the
|
|
* nested NMI paths are careful to preserve CR2.
|
|
*/
|
|
unsigned long
|
|
copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
|
|
{
|
|
unsigned long ret;
|
|
|
|
if (__range_not_ok(from, n, TASK_SIZE))
|
|
return n;
|
|
|
|
/*
|
|
* Even though this function is typically called from NMI/IRQ context
|
|
* disable pagefaults so that its behaviour is consistent even when
|
|
* called form other contexts.
|
|
*/
|
|
pagefault_disable();
|
|
ret = __copy_from_user_inatomic(to, from, n);
|
|
pagefault_enable();
|
|
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(copy_from_user_nmi);
|