Skip to content

Commit

Permalink
ARM: 9326/1: make <linux/uaccess.h> self-contained for ARM
Browse files Browse the repository at this point in the history
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 the errors, make some asm headers self-contained:

 1. In arch/arm/include/asm/domain.h, include <linux/thread_info.h>
    for current_thread_info().

 2. In arch/arm/include/asm/traps.h, remove unneeded  __init, and
    include <linux/linkage.h> for asmlinkage.

 3. In arch/arm/include/asm/uaccess.h, include <linux/kernel.h> for
    might_fault().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
  • Loading branch information
Masahiro Yamada authored and Russell King (Oracle) committed Oct 5, 2023
1 parent 24d3ba0 commit c7368dd
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/arm/include/asm/domain.h
Original file line number Diff line number Diff line change
@@ -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

/*
3 changes: 2 additions & 1 deletion arch/arm/include/asm/traps.h
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
#ifndef _ASMARM_TRAP_H
#define _ASMARM_TRAP_H

#include <linux/linkage.h>
#include <linux/list.h>

struct pt_regs;
@@ -28,7 +29,7 @@ static inline int __in_irqentry_text(unsigned long ptr)
ptr < (unsigned long)&__irqentry_text_end;
}

extern void __init early_trap_init(void *);
extern void early_trap_init(void *);
extern void dump_backtrace_entry(unsigned long where, unsigned long from,
unsigned long frame, const char *loglvl);
extern void ptrace_break(struct pt_regs *regs);
1 change: 1 addition & 0 deletions arch/arm/include/asm/uaccess.h
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit c7368dd

Please sign in to comment.