Re: [PATCH V7 2/4] perf tools: parse the pmu event prefix and suffix
From: Jiri Olsa
Date: Sun Oct 05 2014 - 15:02:36 EST
On Fri, Oct 03, 2014 at 12:09:06PM -0400, kan.liang@xxxxxxxxx wrote:
> From: Kan Liang <kan.liang@xxxxxxxxx>
SNIP
> +/*
> + * Read the pmu events list from sysfs
> + * Save it into perf_pmu_events_list
> + */
> +static void perf_pmu__parse_init(void)
> +{
> +
> + struct perf_pmu *pmu = NULL;
> + struct perf_pmu_alias *alias;
> + int len = 0;
> +
> + pmu = perf_pmu__find("cpu");
> + if ((pmu == NULL) || list_empty(&pmu->aliases)) {
> + perf_pmu_events_list_num = -1;
> + return;
> + }
> + list_for_each_entry(alias, &pmu->aliases, list) {
> + if (strchr(alias->name, '-'))
> + len++;
> + len++;
> + }
> + perf_pmu_events_list = malloc(sizeof(struct perf_pmu_event_symbol) * len);
> + perf_pmu_events_list_num = len;
missing allocation failure check
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/