Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH] trace/hwlat: Add WARN_ON in move_to_next_cpu()
@ 2025-08-11  8:01 Fushuai Wang
  2025-08-14 19:06 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Fushuai Wang @ 2025-08-11  8:01 UTC (permalink / raw)
  To: linux-trace-kernel, linux-kernel
  Cc: rostedt, mhiramat, mathieu.desnoyers, Fushuai Wang

Add a WARN_ON check in move_to_next_cpu(). Next_cpu should
never be greater than or equal to nr_cpu_ids.

Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
---
 kernel/trace/trace_hwlat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c
index 2f7b94e98317..5024b0dcdbba 100644
--- a/kernel/trace/trace_hwlat.c
+++ b/kernel/trace/trace_hwlat.c
@@ -328,7 +328,7 @@ static void move_to_next_cpu(void)
 	next_cpu = cpumask_next_wrap(raw_smp_processor_id(), current_mask);
 	cpus_read_unlock();
 
-	if (next_cpu >= nr_cpu_ids) /* Shouldn't happen! */
+	if (WARN_ON(next_cpu >= nr_cpu_ids)) /* Shouldn't happen! */
 		goto change_mode;
 
 	cpumask_clear(current_mask);
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-14 19:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11  8:01 [PATCH] trace/hwlat: Add WARN_ON in move_to_next_cpu() Fushuai Wang
2025-08-14 19:06 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox