Re: [PATCH] riscv: kprobe: Fixup kernel panic when probing an illegal position

From: Björn Töpel
Date: Thu Feb 02 2023 - 03:32:54 EST


Guo Ren <guoren@xxxxxxxxxx> writes:

>> > - tmp += GET_INSN_LENGTH(*(kprobe_opcode_t *)tmp);
>> > + memcpy(&opcode, (void *)tmp, sizeof(kprobe_opcode_t));
>> > + tmp += GET_INSN_LENGTH(opcode);
>>
>> I'd prefer sizeof(opcode).
> prefer sizeof(opcode) = 4
>
> GET_INSN_LENGTH(opcode) returns 2 or 4;

Sorry for being unclear. I was referring to the sizeof in the memcpy.