ARM: make <linux/uaccess.h> self-contained for ARM
Commit Message
When I compiled the following code for ARM, I encountered numerous
errors.
[Test Code]
#include <linux/compiler.h>
#include <linux/uaccess.h>
int foo(int *x, int __user *ptr)
{
return get_user(*x, ptr);
}
To fix them, make some asm headers self-contained:
1. In arch/arm/include/asm/traps.h, include <linux/init.h> for __init,
and <linux/linkage.h> for asmlinkage.
2. In arch/arm/include/asm/domain.h, include <linux/thread_info.h>
for current_thread_info().
3. In arch/arm/include/asm/uaccess.h, include <linux/kernel.h> for
might_fault().
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
KernelVersion: v6.6-rc1
arch/arm/include/asm/domain.h | 2 +-
arch/arm/include/asm/traps.h | 2 ++
arch/arm/include/asm/uaccess.h | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
Comments
On Wed, Sep 27, 2023 at 02:22:53AM +0900, Masahiro Yamada wrote:
> When I compiled the following code for ARM, I encountered numerous
> errors.
>
> [Test Code]
>
> #include <linux/compiler.h>
> #include <linux/uaccess.h>
>
> int foo(int *x, int __user *ptr)
> {
> return get_user(*x, ptr);
> }
>
> To fix them, make some asm headers self-contained:
>
> 1. In arch/arm/include/asm/traps.h, include <linux/init.h> for __init,
> and <linux/linkage.h> for asmlinkage.
Please drop the __init marking instead of adding linux/init.h, it's
not necessary.
Thanks.
@@ -8,8 +8,8 @@
#define __ASM_PROC_DOMAIN_H
#ifndef __ASSEMBLY__
+#include <linux/thread_info.h>
#include <asm/barrier.h>
-#include <asm/thread_info.h>
#endif
/*
@@ -2,6 +2,8 @@
#ifndef _ASMARM_TRAP_H
#define _ASMARM_TRAP_H
+#include <linux/init.h>
+#include <linux/linkage.h>
#include <linux/list.h>
struct pt_regs;
@@ -8,6 +8,7 @@
/*
* User space memory access functions
*/
+#include <linux/kernel.h>
#include <linux/string.h>
#include <asm/page.h>
#include <asm/domain.h>