diff options
author | Amit Daniel Kachhap <amit.kachhap@arm.com> | 2021-09-17 11:28:11 +0530 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2021-09-29 16:44:20 +0100 |
commit | f5b650f887f30dda15a8d524249e48a407544126 (patch) | |
tree | 2517a37700d7e3cba760fd3270e4161bf15cfc77 /arch | |
parent | 5816b3e6577eaa676ceb00a848f0fd65fe2adc29 (diff) | |
download | linux-f5b650f887f30dda15a8d524249e48a407544126.tar.gz linux-f5b650f887f30dda15a8d524249e48a407544126.tar.bz2 linux-f5b650f887f30dda15a8d524249e48a407544126.zip |
arm64/traps: Avoid unnecessary kernel/user pointer conversion
Annotating a pointer from kernel to __user and then back again requires
an extra __force annotation to silent sparse warning. In call_undef_hook()
this unnecessary complexity can be avoided by modifying the intermediate
user pointer to unsigned long.
This way there is no inter-changeable use of user and kernel pointers
and the code is consistent.
Note: This patch adds no functional changes to code.
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20210917055811.22341-1-amit.kachhap@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm64/kernel/traps.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index b03e383d944a..09236751283e 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -400,11 +400,11 @@ static int call_undef_hook(struct pt_regs *regs) unsigned long flags; u32 instr; int (*fn)(struct pt_regs *regs, u32 instr) = NULL; - void __user *pc = (void __user *)instruction_pointer(regs); + unsigned long pc = instruction_pointer(regs); if (!user_mode(regs)) { __le32 instr_le; - if (get_kernel_nofault(instr_le, (__force __le32 *)pc)) + if (get_kernel_nofault(instr_le, (__le32 *)pc)) goto exit; instr = le32_to_cpu(instr_le); } else if (compat_thumb_mode(regs)) { |