There's no need to read the string ':' or '/' for PE_BP_COLON or
PE_BP_SLASH and doing so causes parse-events.y to leak memory.
The original patch has a committer note about not using these tokens
presumably as yacc spotted they were a memory leak because no
%destructor could be run. Remove the unused token workaround as there
is now no value associated with these tokens.
Fixes: f0617f526cb0c482 ("perf parse: Allow config terms with breakpoints")
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.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: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230613182629.1500317-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
void parse_events_error__print(struct parse_events_error *err,
const char *event);
-static inline void parse_events_unused_value(const void *x __maybe_unused)
-{
-}
-
#ifdef HAVE_LIBELF_SUPPORT
/*
* If the probe point starts with '%',
* are the same, so trailing context can be used disambiguate the two
* cases.
*/
-":"/{modifier_bp} { return str(yyscanner, PE_BP_COLON); }
+":"/{modifier_bp} { return PE_BP_COLON; }
/*
* The slash before memory length can get mixed up with the slash before
* config terms. Fortunately config terms do not start with a numeric
* digit, so trailing context can be used disambiguate the two cases.
*/
-"/"/{digit} { return str(yyscanner, PE_BP_SLASH); }
+"/"/{digit} { return PE_BP_SLASH; }
"/"/{non_digit} { BEGIN(config); return '/'; }
{num_dec} { return value(yyscanner, 10); }
{num_hex} { return value(yyscanner, 16); }
%type <str> PE_LEGACY_CACHE
%type <str> PE_MODIFIER_EVENT
%type <str> PE_MODIFIER_BP
-%type <str> PE_BP_COLON
-%type <str> PE_BP_SLASH
%type <str> PE_EVENT_NAME
%type <str> PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
%type <str> PE_DRV_CFG_TERM
struct list_head *list;
int err;
- parse_events_unused_value(&$3);
- parse_events_unused_value(&$5);
-
list = alloc_list();
ABORT_ON(!list);
err = parse_events_add_breakpoint(_parse_state, list,
struct list_head *list;
int err;
- parse_events_unused_value(&$3);
-
list = alloc_list();
ABORT_ON(!list);
err = parse_events_add_breakpoint(_parse_state, list,
struct list_head *list;
int err;
- parse_events_unused_value(&$3);
-
list = alloc_list();
ABORT_ON(!list);
err = parse_events_add_breakpoint(_parse_state, list,