[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221014015956.2006-2-thunder.leizhen@huawei.com>
Date: Fri, 14 Oct 2022 09:59:54 +0800
From: Zhen Lei <thunder.leizhen@...wei.com>
To: Russell King <linux@...linux.org.uk>,
Ard Biesheuvel <ardb@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
CC: Zhen Lei <thunder.leizhen@...wei.com>
Subject: [PATCH v3 1/3] ARM: Fix some check warnings of tool sparse
Fix the following warnings:
warning: incorrect type in initializer (different address spaces)
expected unsigned short [noderef] __user *register __p
got unsigned short [usertype] *
warning: cast removes address space '__user' of expression
Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
arch/arm/kernel/traps.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 20b2db6dcd1ced7..d455c97237e2079 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -188,9 +188,9 @@ static void dump_instr(const char *lvl, struct pt_regs *regs)
}
} else {
if (thumb)
- bad = get_user(val, &((u16 *)addr)[i]);
+ bad = get_user(val, &((u16 __user *)addr)[i]);
else
- bad = get_user(val, &((u32 *)addr)[i]);
+ bad = get_user(val, &((u32 __user *)addr)[i]);
}
if (!bad)
@@ -448,9 +448,9 @@ int call_undef_hook(struct pt_regs *regs, unsigned int instr)
asmlinkage void do_undefinstr(struct pt_regs *regs)
{
unsigned int instr;
- void __user *pc;
+ void *pc;
- pc = (void __user *)instruction_pointer(regs);
+ pc = (void *)instruction_pointer(regs);
if (processor_mode(regs) == SVC_MODE) {
#ifdef CONFIG_THUMB2_KERNEL
@@ -494,7 +494,7 @@ asmlinkage void do_undefinstr(struct pt_regs *regs)
}
#endif
arm_notify_die("Oops - undefined instruction", regs,
- SIGILL, ILL_ILLOPC, pc, 0, 6);
+ SIGILL, ILL_ILLOPC, (void __user *)pc, 0, 6);
}
NOKPROBE_SYMBOL(do_undefinstr)
--
2.25.1
Powered by blists - more mailing lists