Skip to content

Commit f5b650f

Browse files
amitdanielkachhapwilldeacon
authored andcommitted
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 <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Amit Daniel Kachhap <[email protected]> Acked-by: Mark Rutland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 5816b3e commit f5b650f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/kernel/traps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,11 @@ static int call_undef_hook(struct pt_regs *regs)
400400
unsigned long flags;
401401
u32 instr;
402402
int (*fn)(struct pt_regs *regs, u32 instr) = NULL;
403-
void __user *pc = (void __user *)instruction_pointer(regs);
403+
unsigned long pc = instruction_pointer(regs);
404404

405405
if (!user_mode(regs)) {
406406
__le32 instr_le;
407-
if (get_kernel_nofault(instr_le, (__force __le32 *)pc))
407+
if (get_kernel_nofault(instr_le, (__le32 *)pc))
408408
goto exit;
409409
instr = le32_to_cpu(instr_le);
410410
} else if (compat_thumb_mode(regs)) {

0 commit comments

Comments
 (0)