diff options
| author | Ian Rogers <[email protected]> | 2022-06-14 07:33:52 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2022-10-04 08:55:21 -0300 |
| commit | d773c999b8d22ad3ffd42eca373ebae4cb6512fd (patch) | |
| tree | 6c2b03e36e0210aa0022ff68412eb695a53efadb /tools/lib | |
| parent | 3657ad4b0fb6a6c3df12cec92013614212f5f401 (diff) | |
perf events: Prefer union over variable length array
It is possible for casts to introduce alignment issues, prefer a union
for perf_record_event_update.
Signed-off-by: Ian Rogers <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Alexey Bayduraev <[email protected]>
Cc: Athira Jajeev <[email protected]>
Cc: Colin Ian King <[email protected]>
Cc: Dave Marchevsky <[email protected]>
Cc: German Gomez <[email protected]>
Cc: Gustavo A. R. Silva <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Kees Kook <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Riccardo Mancini <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/lib')
| -rw-r--r-- | tools/lib/perf/include/perf/event.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/lib/perf/include/perf/event.h b/tools/lib/perf/include/perf/event.h index d8ae4e944467..e147e6183292 100644 --- a/tools/lib/perf/include/perf/event.h +++ b/tools/lib/perf/include/perf/event.h @@ -233,7 +233,16 @@ struct perf_record_event_update { struct perf_event_header header; __u64 type; __u64 id; - char data[]; + union { + /* Used when type == PERF_EVENT_UPDATE__SCALE. */ + struct perf_record_event_update_scale scale; + /* Used when type == PERF_EVENT_UPDATE__UNIT. */ + char unit[0]; + /* Used when type == PERF_EVENT_UPDATE__NAME. */ + char name[0]; + /* Used when type == PERF_EVENT_UPDATE__CPUS. */ + struct perf_record_event_update_cpus cpus; + }; }; #define MAX_EVENT_NAME 64 |