Linux Trace Kernel
 help / color / mirror / Atom feed
From: Fushuai Wang <wangfushuai@baidu.com>
To: <linux-trace-kernel@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <rostedt@goodmis.org>, <mhiramat@kernel.org>,
	<mathieu.desnoyers@efficios.com>,
	Fushuai Wang <wangfushuai@baidu.com>
Subject: [PATCH] trace/hwlat: Add WARN_ON in move_to_next_cpu()
Date: Mon, 11 Aug 2025 16:01:09 +0800	[thread overview]
Message-ID: <20250811080109.8417-1-wangfushuai@baidu.com> (raw)

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


             reply	other threads:[~2025-08-11  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11  8:01 Fushuai Wang [this message]
2025-08-14 19:06 ` [PATCH] trace/hwlat: Add WARN_ON in move_to_next_cpu() Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250811080109.8417-1-wangfushuai@baidu.com \
    --to=wangfushuai@baidu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox