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]
Message-Id: <20181023004116.77465-1-mka@chromium.org>
Date:   Mon, 22 Oct 2018 17:41:16 -0700
From:   Matthias Kaehlcke <mka@...omium.org>
To:     Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>
Cc:     linux-kernel@...r.kernel.org, Philipp Klocke <Phil_K97@....de>,
        Guenter Roeck <groeck@...omium.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Matthias Kaehlcke <mka@...omium.org>
Subject: [PATCH] sched: Make sched_feat(x) boolean for !CONFIG_SCHED_DEBUG

If scheduler debugging is disabled sched_feat() resolves to a constant
value that can be non-boolean. clang raises a warning when it detects
that a non-boolean constant is used as operand in logical expressions:

kernel/sched/core.c:208:26: warning: use of logical '&&' with constant
  operand [-Wconstant-logical-operand]
    if ((irq_delta + steal) && sched_feat(NONTASK_CAPACITY))
                            ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Convert the original expression to boolean by means of a double not
operation.

Reported-by: Philipp Klocke <Phil_K97@....de>
Suggested-by: Peter Zijlstra <peterz@...radead.org>
Signed-off-by: Matthias Kaehlcke <mka@...omium.org>
---
 kernel/sched/sched.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 4a2e8cae63c4..b9387d35e261 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1393,7 +1393,7 @@ static const_debug __maybe_unused unsigned int sysctl_sched_features =
 	0;
 #undef SCHED_FEAT
 
-#define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x))
+#define sched_feat(x) (!!(sysctl_sched_features & (1UL << __SCHED_FEAT_##x)))
 
 #endif /* SCHED_DEBUG && HAVE_JUMP_LABEL */
 
-- 
2.19.1.568.g152ad8e336-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ