diff options
| author | Raul Silvera <[email protected]> | 2022-06-21 15:27:25 +0000 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <[email protected]> | 2022-06-26 15:32:55 +0000 |
| commit | 37ed2cddcbf1b52b03b9b2344c752ed867fa3539 (patch) | |
| tree | 4ad4defb508f0c18e06469bf1528c917b9e28d4d /tools/perf/builtin-inject.c | |
| parent | perf trace beauty: Fix generation of errno id->str table on ALT Linux (diff) | |
| download | kernel-37ed2cddcbf1b52b03b9b2344c752ed867fa3539.tar.gz kernel-37ed2cddcbf1b52b03b9b2344c752ed867fa3539.zip | |
perf inject: Adjust output data offset for backward compatibility
When 'perf inject' creates a new file, it reuses the data offset from
the input file. If there has been a change on the size of the header, as
happened in v5.12 -> v5.13, the new offsets will be wrong, resulting in
a corrupted output file.
This change adds the function perf_session__data_offset to compute the
data offset based on the current header size, and uses that instead of
the offset from the original input file.
Signed-off-by: Raul Silvera <[email protected]>
Acked-by: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Athira Jajeev <[email protected]>
Cc: Colin Ian King <[email protected]>
Cc: Dave Marchevsky <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/builtin-inject.c')
| -rw-r--r-- | tools/perf/builtin-inject.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 063f74f5b8db..54d4e508a092 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c @@ -918,7 +918,7 @@ static int __cmd_inject(struct perf_inject *inject) inject->tool.tracing_data = perf_event__repipe_tracing_data; } - output_data_offset = session->header.data_offset; + output_data_offset = perf_session__data_offset(session->evlist); if (inject->build_id_all) { inject->tool.mmap = perf_event__repipe_buildid_mmap; |
