From: Zhen Lei <thunder.leizhen@huawei.com>
To: Russell King <linux@armlinux.org.uk>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Subject: [PATCH v2 1/2] ARM: Fix some check warnings of tool sparse
Date: Mon, 10 Oct 2022 17:53:45 +0800 [thread overview]
Message-ID: <20221010095346.1957-2-thunder.leizhen@huawei.com> (raw)
In-Reply-To: <20221010095346.1957-1-thunder.leizhen@huawei.com>
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@huawei.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..34aa80c09c508c1 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)
@@ -455,15 +455,15 @@ asmlinkage void do_undefinstr(struct pt_regs *regs)
if (processor_mode(regs) == SVC_MODE) {
#ifdef CONFIG_THUMB2_KERNEL
if (thumb_mode(regs)) {
- instr = __mem_to_opcode_thumb16(((u16 *)pc)[0]);
+ instr = __mem_to_opcode_thumb16(((__force u16 *)pc)[0]);
if (is_wide_instruction(instr)) {
u16 inst2;
- inst2 = __mem_to_opcode_thumb16(((u16 *)pc)[1]);
+ inst2 = __mem_to_opcode_thumb16(((__force u16 *)pc)[1]);
instr = __opcode_thumb32_compose(instr, inst2);
}
} else
#endif
- instr = __mem_to_opcode_arm(*(u32 *) pc);
+ instr = __mem_to_opcode_arm(*(__force u32 *) pc);
} else if (thumb_mode(regs)) {
if (get_user(instr, (u16 __user *)pc))
goto die_sig;
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-10-10 9:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 9:53 [PATCH v2 0/2] ARM: Make the dumped instructions are consistent with the disassembled ones Zhen Lei
2022-10-10 9:53 ` Zhen Lei [this message]
2022-10-10 10:20 ` [PATCH v2 1/2] ARM: Fix some check warnings of tool sparse Ard Biesheuvel
2022-10-10 10:58 ` Leizhen (ThunderTown)
2022-10-10 11:06 ` Ard Biesheuvel
2022-10-10 16:08 ` Russell King (Oracle)
2022-10-10 16:14 ` Ard Biesheuvel
2022-10-10 16:17 ` Russell King (Oracle)
2022-10-11 2:29 ` Leizhen (ThunderTown)
2022-10-13 10:51 ` Russell King (Oracle)
2022-10-13 11:34 ` Leizhen (ThunderTown)
2022-11-28 8:39 ` Leizhen (ThunderTown)
2022-10-10 16:05 ` Russell King (Oracle)
2022-10-11 2:13 ` Leizhen (ThunderTown)
2022-10-13 1:28 ` Leizhen (ThunderTown)
2022-10-10 9:53 ` [PATCH v2 2/2] ARM: Make the dumped instructions are consistent with the disassembled ones Zhen Lei
2022-10-10 10:10 ` Ard Biesheuvel
2022-10-10 10:46 ` Leizhen (ThunderTown)
2022-10-10 11:07 ` Ard Biesheuvel
2022-10-10 11:29 ` Leizhen (ThunderTown)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221010095346.1957-2-thunder.leizhen@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).