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 <wangfush...@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 via email to