public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Gordeev <agordeev@linux.ibm.com>
To: linux-s390@vger.kernel.org
Cc: Yury Norov <yury.norov@gmail.com>,
	Andrew Jones <ajones@ventanamicro.com>
Subject: [PATCH] s390/cpuinfo: prevent warning when reading /proc/cpuinfo
Date: Fri, 14 Oct 2022 16:26:11 +0200	[thread overview]
Message-ID: <20221014142611.1145407-1-agordeev@linux.ibm.com> (raw)

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


             reply	other threads:[~2022-10-14 14:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 14:26 Alexander Gordeev [this message]
2022-10-14 15:06 ` [PATCH] s390/cpuinfo: prevent warning when reading /proc/cpuinfo Yury Norov
2022-10-14 15:36   ` Andrew Jones

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=20221014142611.1145407-1-agordeev@linux.ibm.com \
    --to=agordeev@linux.ibm.com \
    --cc=ajones@ventanamicro.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=yury.norov@gmail.com \
    /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