Skip to content

Commit 36b4cd9

Browse files
ahunter6namhyung
authored andcommitted
perf intel-pt: Fix aux_watermark calculation for 64-bit size
aux_watermark is a u32. For a 64-bit size, cap the aux_watermark calculation at UINT_MAX instead of truncating it to 32-bits. Fixes: 874fc35 ("perf intel-pt: Use aux_watermark") Signed-off-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 74ad3cb commit 36b4cd9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/perf/arch/x86/util/intel-pt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,8 @@ static int intel_pt_recording_options(struct auxtrace_record *itr,
758758
}
759759

760760
if (!opts->auxtrace_snapshot_mode && !opts->auxtrace_sample_mode) {
761-
u32 aux_watermark = opts->auxtrace_mmap_pages * page_size / 4;
761+
size_t aw = opts->auxtrace_mmap_pages * (size_t)page_size / 4;
762+
u32 aux_watermark = aw > UINT_MAX ? UINT_MAX : aw;
762763

763764
intel_pt_evsel->core.attr.aux_watermark = aux_watermark;
764765
}

0 commit comments

Comments
 (0)