lkml.org 
[lkml]   [2021]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[tip: x86/core] perf/x86/intel/ds: Check insn_get_length() retval
The following commit has been merged into the x86/core branch of tip:

Commit-ID: 2ff49881d606d5e0d5b27cb6066c8a18689bd341
Gitweb: https://git.kernel.org/tip/2ff49881d606d5e0d5b27cb6066c8a18689bd341
Author: Borislav Petkov <bp@suse.de>
AuthorDate: Fri, 06 Nov 2020 16:33:34 +01:00
Committer: Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 15 Mar 2021 11:20:29 +01:00

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
---
arch/x86/events/intel/ds.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index 7ebae18..cdd195a 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;
\
 
 \ /
  Last update: 2021-03-15 17:09    [W:0.208 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site