public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390/cpuinfo: prevent warning when reading /proc/cpuinfo
@ 2022-10-14 14:26 Alexander Gordeev
  2022-10-14 15:06 ` Yury Norov
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Gordeev @ 2022-10-14 14:26 UTC (permalink / raw)
  To: linux-s390; +Cc: Yury Norov, Andrew Jones

Commit 78e5a3399421 ("cpumask: fix checking valid cpu range") has
started issuing warnings when reading /proc/cpuinfo and config
DEBUG_PER_CPU_MAPS is enabled. Avoid calling cpumask_next() with
the cpu index equal to nr_cpu_ids - 1 and ensure no warning is
generated.

Link: https://lore.kernel.org/r/20221012081905.1800640-1-ajones@ventanamicro.com
Reported-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
---
 arch/s390/kernel/processor.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
index a194611ba88c..908a0be900ea 100644
--- a/arch/s390/kernel/processor.c
+++ b/arch/s390/kernel/processor.c
@@ -334,6 +334,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 
 static inline void *c_update(loff_t *pos)
 {
+	if (*pos >= nr_cpu_ids)
+		return NULL;
 	if (*pos)
 		*pos = cpumask_next(*pos - 1, cpu_online_mask);
 	else
-- 
2.34.1


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

end of thread, other threads:[~2022-10-14 15:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-14 14:26 [PATCH] s390/cpuinfo: prevent warning when reading /proc/cpuinfo Alexander Gordeev
2022-10-14 15:06 ` Yury Norov
2022-10-14 15:36   ` Andrew Jones

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