Skip to content

Commit

Permalink
perf annotate: Return appropriate error code for allocation failures
Browse files Browse the repository at this point in the history
We should return errno or the annotation extra range understood by
symbol__strerror_disassemble() instead of -1, fix it, returning ENOMEM
instead.

Reported-by: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Cc: Will Deacon <will@kernel.org>
Link: https://lkml.kernel.org/n/tip-8of1cmj3rz0mppfcshc9bbqq@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Arnaldo Carvalho de Melo committed Sep 30, 2019
1 parent 42d7a91 commit 16ed3c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/perf/util/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil

build_id_path = strdup(filename);
if (!build_id_path)
return -1;
return ENOMEM;

/*
* old style build-id cache has name of XX/XXXXXXX.. while
Expand Down Expand Up @@ -2977,7 +2977,7 @@ int symbol__annotate2(struct symbol *sym, struct map *map, struct evsel *evsel,

notes->offsets = zalloc(size * sizeof(struct annotation_line *));
if (notes->offsets == NULL)
return -1;
return ENOMEM;

if (perf_evsel__is_group_event(evsel))
nr_pcnt = evsel->core.nr_members;
Expand Down

0 comments on commit 16ed3c1

Please sign in to comment.