From: menglong8.dong@gmail.com
To: guoren@kernel.org
Cc: dong.menglong@zte.com.cn, linux-csky@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] csky: kprobe: fix unreachable code in simulate_blz32
Date: Mon, 11 Jan 2021 06:25:17 -0800 [thread overview]
Message-ID: <20210111142517.4959-1-dong.menglong@zte.com.cn> (raw)
From: Menglong Dong <dong.menglong@zte.com.cn>
The type of 'val' is 'unsigned long' in simulate_blz32, so 'val < 0'
can't be true.
When 'csky_insn_reg_get_val' fails, 'false' will be returned. We
can directly use its return value here.
Fixes: 33e53ae1ce41 ("csky: Add kprobes supported")
Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
---
arch/csky/kernel/probes/simulate-insn.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/csky/kernel/probes/simulate-insn.c b/arch/csky/kernel/probes/simulate-insn.c
index 4e464fed52ec..b09ddcbcfa18 100644
--- a/arch/csky/kernel/probes/simulate-insn.c
+++ b/arch/csky/kernel/probes/simulate-insn.c
@@ -346,9 +346,7 @@ simulate_blz32(u32 opcode, long addr, struct pt_regs *regs)
unsigned long tmp = opcode & 0x1f;
unsigned long val;
- csky_insn_reg_get_val(regs, tmp, &val);
-
- if (val < 0) {
+ if (!csky_insn_reg_get_val(regs, tmp, &val)) {
instruction_pointer_set(regs,
addr + sign_extend32((opcode & 0xffff0000) >> 15, 15));
} else
--
2.17.1
next reply other threads:[~2021-01-11 14:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 14:25 menglong8.dong [this message]
2021-01-12 2:31 ` [PATCH] csky: kprobe: fix unreachable code in simulate_blz32 Guo Ren
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=20210111142517.4959-1-dong.menglong@zte.com.cn \
--to=menglong8.dong@gmail.com \
--cc=dong.menglong@zte.com.cn \
--cc=guoren@kernel.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).