Re: [PATCH V2 2/3] perf tools: parse the pmu event prefix and surfix

From: Andi Kleen
Date: Wed Aug 27 2014 - 12:23:47 EST


> + while ((pmu = perf_pmu__scan(pmu)) != NULL)
> + list_for_each_entry(alias, &pmu->aliases, list) {
> + if (!strcmp(pmu->name, "cpu")) {
> + struct kernel_pmu_event_symbol *p =
> + kernel_pmu_events_list + len;
> + char *tmp = strchr(alias->name, '-');
> +
> + if (tmp != NULL) {
> + strncpy(p->symbol, alias->name,
> + tmp - alias->name);

Please use strlcpy(). Otherwise p->symbol may not be zero terminated.

The rest of the patch looks good to me.

-Andi
--
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/