The following commit has been merged into the perf/core branch of tip:
Commit-ID: 52a6457f59adf70d624ef1b1bed8d55cb7b73af6
Gitweb: https://git.kernel.org/tip/52a6457f59adf70d624ef1b1bed8d55cb7b73af6
Author: Thorsten Blum <blum@kernel.org>
AuthorDate: Fri, 04 Sep 2026 16:17:00 +02:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 25 Sep 2026 12:45:52 +02:00
perf/x86/intel: Annotate x86_pmu::hybrid_pmu with __counted_by_ptr
Add __counted_by_ptr() to x86_pmu::hybrid_pmu to improve access bounds
checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.
Signed-off-by: Thorsten Blum <blum@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Link: https://patch.msgid.link/20260904141659.224248-2-blum@kernel.org
---
arch/x86/events/perf_event.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h
index 6eb1bf4..5deca1a 100644
--- a/arch/x86/events/perf_event.h
+++ b/arch/x86/events/perf_event.h
@@ -1245,7 +1245,7 @@ struct x86_pmu {
* unique capabilities.
*/
int num_hybrid_pmus;
- struct x86_hybrid_pmu *hybrid_pmu;
+ struct x86_hybrid_pmu *hybrid_pmu __counted_by_ptr(num_hybrid_pmus);
enum intel_cpu_type (*get_hybrid_cpu_type) (void);
};