Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
9462e4de 88cc47e2

+6 -3
+1 -1
tools/perf/util/Build
··· 246 246 247 247 $(OUTPUT)util/parse-events-bison.c $(OUTPUT)util/parse-events-bison.h: util/parse-events.y 248 248 $(call rule_mkdir) 249 - $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) \ 249 + $(Q)$(call echo-cmd,bison)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) $(BISON_FILE_PREFIX_MAP) $(BISON_FALLBACK_FLAGS) \ 250 250 -o $(OUTPUT)util/parse-events-bison.c -p parse_events_ 251 251 252 252 $(OUTPUT)util/expr-flex.c $(OUTPUT)util/expr-flex.h: util/expr.l $(OUTPUT)util/expr-bison.c
+4 -1
tools/perf/util/parse-events.c
··· 1973 1973 struct evsel *evsel; 1974 1974 1975 1975 __evlist__for_each_entry(list, evsel) { 1976 - if (!evsel->name) 1976 + if (!evsel->name) { 1977 1977 evsel->name = strdup(name); 1978 + if (!evsel->name) 1979 + return -ENOMEM; 1980 + } 1978 1981 } 1979 1982 1980 1983 return 0;
+1 -1
tools/perf/util/parse-events.y
··· 263 263 free($1); 264 264 if (err) { 265 265 free_list_evsel($2); 266 - YYABORT; 266 + YYNOMEM; 267 267 } 268 268 $$ = $2; 269 269 }