From b514860b30cfa6edb4379a580c65948058646eab Mon Sep 17 00:00:00 2001 From: Josh Minor Date: Wed, 13 Sep 2023 09:53:49 -0500 Subject: [PATCH] Set size of perf_attr_struct prior to getting pfm encoding Signed-off-by: Josh Minor --- src/components/perf_event/pe_libpfm4_events.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/perf_event/pe_libpfm4_events.c b/src/components/perf_event/pe_libpfm4_events.c index a4f8e5d4b..859f10c8a 100644 --- a/src/components/perf_event/pe_libpfm4_events.c +++ b/src/components/perf_event/pe_libpfm4_events.c @@ -191,6 +191,9 @@ static struct native_event_t *allocate_native_event( perf_arg.attr=&ntv_evt->attr; perf_arg.fstr=&event_string; + // set the size of the perf attr struct before getting pfm encoding + ntv_evt->attr.size = sizeof(struct perf_event_attr); + /* use user provided name of the event to get the */ /* perf_event encoding and a fully qualified event string */ ret = pfm_get_os_event_encoding(name,