Commit b3ce7692 authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Arnaldo Carvalho de Melo
Browse files

perf disasm: Fix off-by-one bug in outside check



If a branch target points to one past the end of a function, the branch
should be treated as a branch to another function.

This can happen e.g. with a tail call to a function that is laid out
immediately after the caller.

Fixes: 751b1783 ("perf annotate: Mark jumps to outher functions with the call arrow")
Reviewed-by: default avatarIan Rogers <irogers@google.com>
Signed-off-by: default avatarPeter Collingbourne <pcc@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://linux-review.googlesource.com/id/Ide471112e82d68177e0faf08ca411d9fcf0a7bdf


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 1e972ec7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -384,7 +384,7 @@ static int jump__parse(const struct arch *arch, struct ins_operands *ops, struct
	start = map__unmap_ip(map, sym->start);
	end = map__unmap_ip(map, sym->end);

	ops->target.outside = target.addr < start || target.addr > end;
	ops->target.outside = target.addr < start || target.addr >= end;

	/*
	 * FIXME: things like this in _cpp_lex_token (gcc's cc1 program):