[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191023085045.GE22919@krava>
Date: Wed, 23 Oct 2019 10:50:45 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andi Kleen <ak@...ux.intel.com>,
Jin Yao <yao.jin@...ux.intel.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>,
John Garry <john.garry@...wei.com>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
bpf@...r.kernel.org, clang-built-linux@...glegroups.com,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH v2 3/9] perf tools: ensure config and str in terms are
unique
On Tue, Oct 22, 2019 at 05:53:31PM -0700, Ian Rogers wrote:
SNIP
> return -1;
> + }
> list_add_tail(&term->list, head);
>
> if (!parse_events_add_pmu(parse_state, list,
> pmu->name, head,
> true, true)) {
> - pr_debug("%s -> %s/%s/\n", str,
> + pr_debug("%s -> %s/%s/\n", config,
> pmu->name, alias->str);
> ok++;
> }
> @@ -1462,8 +1472,10 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state,
> }
> }
> }
> - if (!ok)
> + if (!ok) {
> + free(list);
> return -1;
> + }
> *listp = list;
> return 0;
> }
> @@ -2761,13 +2773,13 @@ int parse_events_term__sym_hw(struct parse_events_term **term,
> struct parse_events_term temp = {
> .type_val = PARSE_EVENTS__TERM_TYPE_STR,
> .type_term = PARSE_EVENTS__TERM_TYPE_USER,
> - .config = config ?: (char *) "event",
> + .config = config ?: strdup("event"),
there's no check if this succeeds
> };
>
> BUG_ON(idx >= PERF_COUNT_HW_MAX);
> sym = &event_symbols_hw[idx];
>
> - return new_term(term, &temp, (char *) sym->symbol, 0);
> + return new_term(term, &temp, strdup(sym->symbol), 0);
> }
>
> int parse_events_term__clone(struct parse_events_term **new,
> @@ -2776,12 +2788,15 @@ int parse_events_term__clone(struct parse_events_term **new,
> struct parse_events_term temp = {
> .type_val = term->type_val,
> .type_term = term->type_term,
> - .config = term->config,
> + .config = term->config ? strdup(term->config) : NULL,
ditto
also how is this released when term is freed?
thanks,
jirka
Powered by blists - more mailing lists