[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240908-mips-chore-v1-2-9239c783f233@flygoat.com>
Date: Sun, 08 Sep 2024 11:49:43 +0100
From: Jiaxun Yang <jiaxun.yang@...goat.com>
To: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc: linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiaxun Yang <jiaxun.yang@...goat.com>
Subject: [PATCH 2/2] MIPS: kprobes: Massage previous delay slot detection
Expand the if condition into cascaded ifs to make code
readable.
Also use sizeof(union mips_instruction) instead of
sizeof(mips_instruction) to match the code context.
Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
---
arch/mips/kernel/kprobes.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/mips/kernel/kprobes.c b/arch/mips/kernel/kprobes.c
index dc39f5b3fb83..96139adefad2 100644
--- a/arch/mips/kernel/kprobes.c
+++ b/arch/mips/kernel/kprobes.c
@@ -89,12 +89,12 @@ int arch_prepare_kprobe(struct kprobe *p)
goto out;
}
- if (copy_from_kernel_nofault(&prev_insn, p->addr - 1,
- sizeof(mips_instruction)) == 0 &&
- insn_has_delayslot(prev_insn)) {
- pr_notice("Kprobes for branch delayslot are not supported\n");
- ret = -EINVAL;
- goto out;
+ if (!copy_from_kernel_nofault(&prev_insn, p->addr - 1, sizeof(union mips_instruction))) {
+ if (insn_has_delayslot(prev_insn)) {
+ pr_notice("Kprobes for branch delayslot are not supported\n");
+ ret = -EINVAL;
+ goto out;
+ }
}
if (__insn_is_compact_branch(insn)) {
--
2.46.0
Powered by blists - more mailing lists