lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 27 Mar 2017 09:40:46 +0200
From:   Nicholas Mc Guire <der.herr@...r.at>
To:     Ingo Molnar <mingo@...hat.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Rusty Russell <rusty@...tcorp.com.au>,
        Nick Piggin <npiggin@...e.de>, linux-kernel@...r.kernel.org,
        Nicholas Mc Guire <der.herr@...r.at>
Subject: [PATCH] sched/core: switch to BUG_ON()

Use BUG_ON() rather than an explicit if followed by BUG().

Signed-off-by: Nicholas Mc Guire <der.herr@...r.at>
---

Found by coccinelle: bugon.cocci
./kernel/sched/core.c:5913:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG.

There is one checkpatch.pl warning but thats a false positive. To panik()
when there is no core to run init on sounds resonable.

Patch was compile-tested with: x86_64_defconfig (implies CONFIG_SMP=y)
(some unrelated sparse warnings)

Patch is against 4.11-rc4 (localversion-next is next-20170327)

 kernel/sched/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ac88348..b732c16 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5909,8 +5909,8 @@ void __init sched_init_smp(void)
 	mutex_unlock(&sched_domains_mutex);
 
 	/* Move init over to a non-isolated CPU */
-	if (set_cpus_allowed_ptr(current, non_isolated_cpus) < 0)
-		BUG();
+	BUG_ON(set_cpus_allowed_ptr(current, non_isolated_cpus) < 0);
+
 	sched_init_granularity();
 	free_cpumask_var(non_isolated_cpus);
 
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ