We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb80242 commit eb74232Copy full SHA for eb74232
arch/riscv/kernel/probes/kprobes.c
@@ -65,16 +65,18 @@ static bool __kprobes arch_check_kprobe(struct kprobe *p)
65
66
int __kprobes arch_prepare_kprobe(struct kprobe *p)
67
{
68
- unsigned long probe_addr = (unsigned long)p->addr;
+ u16 *insn = (u16 *)p->addr;
69
70
- if (probe_addr & 0x1)
+ if ((unsigned long)insn & 0x1)
71
return -EILSEQ;
72
73
if (!arch_check_kprobe(p))
74
75
76
/* copy instruction */
77
- p->opcode = *p->addr;
+ p->opcode = (kprobe_opcode_t)(*insn++);
78
+ if (GET_INSN_LENGTH(p->opcode) == 4)
79
+ p->opcode |= (kprobe_opcode_t)(*insn) << 16;
80
81
/* decode instruction */
82
switch (riscv_probe_decode_insn(p->addr, &p->ainsn.api)) {
0 commit comments