diff options
author | Ian Rogers <irogers@google.com> | 2023-06-27 20:10:23 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-07-29 00:01:16 +0200 |
commit | 9462e4de62755c85867991a4beccff15377d0e95 (patch) | |
tree | e3418d94f1d897ba32532fe0f9cefa9fe10388af /tools/perf/util/parse-events.c | |
parent | perf build: Define YYNOMEM as YYNOABORT for bison < 3.81 (diff) | |
download | linux-9462e4de62755c85867991a4beccff15377d0e95.tar.xz linux-9462e4de62755c85867991a4beccff15377d0e95.zip |
perf parse-event: Add memory allocation test for name terms
If the name memory allocation fails then propagate to the parser.
Committer notes:
Use $(BISON_FALLBACK_FLAGS) on the bison call so that we continue
building with older bison versions, before 3.81, where YYNOMEM isn't
present.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230627181030.95608-7-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 75778d5be5b6..83adb0c2a6bc 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1973,8 +1973,11 @@ int parse_events_name(struct list_head *list, const char *name) struct evsel *evsel; __evlist__for_each_entry(list, evsel) { - if (!evsel->name) + if (!evsel->name) { evsel->name = strdup(name); + if (!evsel->name) + return -ENOMEM; + } } return 0; |