[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251119224140.8616-4-david.laight.linux@gmail.com>
Date: Wed, 19 Nov 2025 22:40:59 +0000
From: david.laight.linux@...il.com
To: linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
David Laight <david.laight.linux@...il.com>
Subject: [PATCH 03/44] perf: Fix branch stack callchain limit
From: David Laight <david.laight.linux@...il.com>
The code that bounds the brs->nr to event->attr.sample_max_stack
incorrectly masks brs->nr with 65535 before the limit check.
Replace the min_t(u16, ...) with a plain min(...).
I guess there may be another limit on brs->nr (which is u64).
Fixes: c53e14f1ea4a8 ("perf: Extend per event callchain limit to branch stack")
Signed-off-by: David Laight <david.laight.linux@...il.com>
---
include/linux/perf_event.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index fd1d91017b99..f91c875ea311 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1430,7 +1430,7 @@ static inline void perf_sample_save_brstack(struct perf_sample_data *data,
if (branch_sample_hw_index(event))
size += sizeof(u64);
- brs->nr = min_t(u16, event->attr.sample_max_stack, brs->nr);
+ brs->nr = min(event->attr.sample_max_stack, brs->nr);
size += brs->nr * sizeof(struct perf_branch_entry);
--
2.39.5
Powered by blists - more mailing lists