[PATCH v1 01/51] perf tools: Ensure evsel name is initialized

kajoljain kjain at linux.ibm.com
Tue Feb 28 04:06:14 PST 2023



On 2/19/23 14:57, Ian Rogers wrote:
> Use the evsel__name accessor as otherwise name may be NULL resulting
> in a segv. This was observed with the perf stat shell test.
> 
> Signed-off-by: Ian Rogers <irogers at google.com>
> ---
>  tools/perf/util/synthetic-events.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
> index 9ab9308ee80c..6def01036eb5 100644
> --- a/tools/perf/util/synthetic-events.c
> +++ b/tools/perf/util/synthetic-events.c
> @@ -2004,7 +2004,7 @@ int perf_event__synthesize_event_update_name(struct perf_tool *tool, struct evse
>  					     perf_event__handler_t process)
>  {
>  	struct perf_record_event_update *ev;
> -	size_t len = strlen(evsel->name);
> +	size_t len = strlen(evsel__name(evsel));
>  	int err;
>  

Patch looks fine to me

Reviewed-by: Kajol Jain <kjain at linux.ibm.com>

>  	ev = event_update_event__new(len + 1, PERF_EVENT_UPDATE__NAME, evsel->core.id[0]);



More information about the linux-arm-kernel mailing list