x86/alternative: Use insn_decode()
commit 63c66cde7bbcc79aac14b25861c5b2495eede57b upstream. No functional changes, just simplification. Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20210304174237.31945-10-bp@alien8.de Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
e6f8dc86a1
commit
d9cd219114
@@ -1284,15 +1284,15 @@ static void text_poke_loc_init(struct text_poke_loc *tp, void *addr,
|
|||||||
const void *opcode, size_t len, const void *emulate)
|
const void *opcode, size_t len, const void *emulate)
|
||||||
{
|
{
|
||||||
struct insn insn;
|
struct insn insn;
|
||||||
|
int ret;
|
||||||
|
|
||||||
memcpy((void *)tp->text, opcode, len);
|
memcpy((void *)tp->text, opcode, len);
|
||||||
if (!emulate)
|
if (!emulate)
|
||||||
emulate = opcode;
|
emulate = opcode;
|
||||||
|
|
||||||
kernel_insn_init(&insn, emulate, MAX_INSN_SIZE);
|
ret = insn_decode(&insn, emulate, MAX_INSN_SIZE, INSN_MODE_KERN);
|
||||||
insn_get_length(&insn);
|
|
||||||
|
|
||||||
BUG_ON(!insn_complete(&insn));
|
BUG_ON(ret < 0);
|
||||||
BUG_ON(len != insn.length);
|
BUG_ON(len != insn.length);
|
||||||
|
|
||||||
tp->rel_addr = addr - (void *)_stext;
|
tp->rel_addr = addr - (void *)_stext;
|
||||||
|
Reference in New Issue
Block a user