From: "tip-bot2 for Muchun Song" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Muchun Song <songmuchun@bytedance.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86 <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: [tip: sched/core] smp: Fix a potential usage of stale nr_cpus
Date: Wed, 22 Jul 2020 09:12:26 -0000 [thread overview]
Message-ID: <159540914653.4006.6322052574571138388.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20200716070457.53255-1-songmuchun@bytedance.com>
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 589343569d7b58a64ec2446e6686c8e79aea7fcf
Gitweb: https://git.kernel.org/tip/589343569d7b58a64ec2446e6686c8e79aea7fcf
Author: Muchun Song <songmuchun@bytedance.com>
AuthorDate: Thu, 16 Jul 2020 15:04:57 +08:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 22 Jul 2020 10:22:04 +02:00
smp: Fix a potential usage of stale nr_cpus
The get_option() maybe return 0, it means that the nr_cpus is
not initialized. Then we will use the stale nr_cpus to initialize
the nr_cpu_ids. So fix it.
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200716070457.53255-1-songmuchun@bytedance.com
---
kernel/smp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/kernel/smp.c b/kernel/smp.c
index aa17eed..d0ae8eb 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -634,8 +634,7 @@ static int __init nrcpus(char *str)
{
int nr_cpus;
- get_option(&str, &nr_cpus);
- if (nr_cpus > 0 && nr_cpus < nr_cpu_ids)
+ if (get_option(&str, &nr_cpus) && nr_cpus > 0 && nr_cpus < nr_cpu_ids)
nr_cpu_ids = nr_cpus;
return 0;
prev parent reply other threads:[~2020-07-22 9:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 7:04 [PATCH RESEND] " Muchun Song
2020-07-17 20:15 ` Thomas Gleixner
2020-07-18 2:29 ` [External] " Muchun Song
2020-07-22 9:12 ` tip-bot2 for Muchun Song [this message]
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=159540914653.4006.6322052574571138388.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=songmuchun@bytedance.com \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®