Commit 0c925c61 authored by Borislav Petkov's avatar Borislav Petkov

x86/tools/insn_decoder_test: Convert to insn_decode()

Simplify code, no functional changes.
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210304174237.31945-17-bp@alien8.de
parent 88afc239
...@@ -120,7 +120,7 @@ int main(int argc, char **argv) ...@@ -120,7 +120,7 @@ int main(int argc, char **argv)
while (fgets(line, BUFSIZE, stdin)) { while (fgets(line, BUFSIZE, stdin)) {
char copy[BUFSIZE], *s, *tab1, *tab2; char copy[BUFSIZE], *s, *tab1, *tab2;
int nb = 0; int nb = 0, ret;
unsigned int b; unsigned int b;
if (line[0] == '<') { if (line[0] == '<') {
...@@ -148,10 +148,12 @@ int main(int argc, char **argv) ...@@ -148,10 +148,12 @@ int main(int argc, char **argv)
} else } else
break; break;
} }
/* Decode an instruction */ /* Decode an instruction */
insn_init(&insn, insn_buff, sizeof(insn_buff), x86_64); ret = insn_decode(&insn, insn_buff, sizeof(insn_buff),
insn_get_length(&insn); x86_64 ? INSN_MODE_64 : INSN_MODE_32);
if (insn.length != nb) {
if (ret < 0 || insn.length != nb) {
warnings++; warnings++;
pr_warn("Found an x86 instruction decoder bug, " pr_warn("Found an x86 instruction decoder bug, "
"please report this.\n", sym); "please report this.\n", sym);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment