From 0afc076a7836433b455c8aff15d4a3ad9631ebc2 Mon Sep 17 00:00:00 2001 From: Dapeng Mi Date: Sun, 28 Sep 2025 13:50:47 +0800 Subject: [PATCH] perf/x86/intel: Fix NULL event access waring from test robot This patch fixes the warning about https://lore.kernel.org/all/202509081646.d101cfb7-lkp@intel.com/. Signed-off-by: Dapeng Mi --- arch/x86/events/intel/ds.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c index 65908880f424..ef32714cb182 100644 --- a/arch/x86/events/intel/ds.c +++ b/arch/x86/events/intel/ds.c @@ -2821,8 +2821,11 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs, struct perf_sample_d * If collision happened, the record will be dropped. */ if (pebs_status != (1ULL << bit)) { - for_each_set_bit(i, (unsigned long *)&pebs_status, size) + for_each_set_bit(i, (unsigned long *)&pebs_status, size) { error[i]++; + if (error[i] && !events[i]) + events[i] = cpuc->events[i]; + } continue; } -- 2.34.1