linux-csky.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] csky: kprobe: fix unreachable code in simulate_blz32
@ 2021-01-12  3:10 menglong8.dong
  0 siblings, 0 replies; only message in thread
From: menglong8.dong @ 2021-01-12  3:10 UTC (permalink / raw)
  To: guoren; +Cc: dong.menglong, linux-csky, linux-kernel

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.

Cast 'val' to 'long' here to determine branch token or not,
as Guo Ren suggested.

Fixes: 33e53ae1ce41 ("csky: Add kprobes supported")
Signed-off-by: Menglong Dong <dong.menglong@zte.com.cn>
---
v2:
- Cast 'val' to 'long'.
---
 arch/csky/kernel/probes/simulate-insn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/csky/kernel/probes/simulate-insn.c b/arch/csky/kernel/probes/simulate-insn.c
index 4e464fed52ec..9ad771c47670 100644
--- a/arch/csky/kernel/probes/simulate-insn.c
+++ b/arch/csky/kernel/probes/simulate-insn.c
@@ -348,7 +348,7 @@ simulate_blz32(u32 opcode, long addr, struct pt_regs *regs)
 
 	csky_insn_reg_get_val(regs, tmp, &val);
 
-	if (val < 0) {
+	if ((long)val < 0) {
 		instruction_pointer_set(regs,
 			addr + sign_extend32((opcode & 0xffff0000) >> 15, 15));
 	} else
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-12  3:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12  3:10 [PATCH v2] csky: kprobe: fix unreachable code in simulate_blz32 menglong8.dong

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).