Skip to content
Commit 3f060523 authored by Nam Cao's avatar Nam Cao Committed by Greg Kroah-Hartman
Browse files

riscv: correct riscv_insn_is_c_jr() and riscv_insn_is_c_jalr()



[ Upstream commit 79bc3f85 ]

The instructions c.jr and c.jalr must have rs1 != 0, but
riscv_insn_is_c_jr() and riscv_insn_is_c_jalr() do not check for this. So,
riscv_insn_is_c_jr() can match a reserved encoding, while
riscv_insn_is_c_jalr() can match the c.ebreak instruction.

Rewrite them with check for rs1 != 0.

Signed-off-by: default avatarNam Cao <namcaov@gmail.com>
Reviewed-by: default avatarCharlie Jenkins <charlie@rivosinc.com>
Fixes: ec5f9087 ("RISC-V: Move riscv_insn_is_* macros into a common header")
Link: https://lore.kernel.org/r/20230731183925.152145-1-namcaov@gmail.com


Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 761cf8f7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment