summaryrefslogtreecommitdiffstats
path: root/arch/x86/events/intel
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2020-11-06 16:33:34 +0100
committerBorislav Petkov <bp@suse.de>2021-03-15 11:20:29 +0100
commit2ff49881d606d5e0d5b27cb6066c8a18689bd341 (patch)
tree15a7dbdba3753823b4bee40be95e5704b589e699 /arch/x86/events/intel
parentx86/boot/compressed/sev-es: Convert to insn_decode() (diff)
downloadlinux-2ff49881d606d5e0d5b27cb6066c8a18689bd341.tar.xz
linux-2ff49881d606d5e0d5b27cb6066c8a18689bd341.zip
perf/x86/intel/ds: Check insn_get_length() retval
intel_pmu_pebs_fixup_ip() needs only the insn length so use the appropriate helper instead of a full decode. A full decode differs only in running insn_complete() on the decoded insn but that is not needed here. Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/20210304174237.31945-8-bp@alien8.de
Diffstat (limited to 'arch/x86/events/intel')
-rw-r--r--arch/x86/events/intel/ds.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index 7ebae1826403..cdd195a3804e 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -1353,14 +1353,13 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
is_64bit = kernel_ip(to) || any_64bit_mode(regs);
#endif
insn_init(&insn, kaddr, size, is_64bit);
- insn_get_length(&insn);
+
/*
- * Make sure there was not a problem decoding the
- * instruction and getting the length. This is
- * doubly important because we have an infinite
- * loop if insn.length=0.
+ * Make sure there was not a problem decoding the instruction.
+ * This is doubly important because we have an infinite loop if
+ * insn.length=0.
*/
- if (!insn.length)
+ if (insn_get_length(&insn))
break;
to += insn.length;