perf record: Ensure space for lost samples
Previous allocation didn't account for sample ID written after the lost samples event. Switch from malloc/free to a stack allocation. Reported-by: Milian Wolff <milian.wolff@kdab.com> Closes: https://lore.kernel.org/linux-perf-users/23879991.0LEYPuXRzz@milian-workstation/ Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20240611050626.1223155-1-irogers@google.com
This commit is contained in:
@@ -77,6 +77,12 @@ struct perf_record_lost_samples {
|
||||
__u64 lost;
|
||||
};
|
||||
|
||||
#define MAX_ID_HDR_ENTRIES 6
|
||||
struct perf_record_lost_samples_and_ids {
|
||||
struct perf_record_lost_samples lost;
|
||||
__u64 sample_ids[MAX_ID_HDR_ENTRIES];
|
||||
};
|
||||
|
||||
/*
|
||||
* PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID | PERF_FORMAT_LOST
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user