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: <1561384781-12308-1-git-send-email-cai@lca.pw>
Date:   Mon, 24 Jun 2019 09:59:41 -0400
From:   Qian Cai <cai@....pw>
To:     mingo@...hat.com, peterz@...radead.org
Cc:     linux-kernel@...r.kernel.org, Qian Cai <cai@....pw>
Subject: [PATCH] sched/core: silence a warning in sched_init()

Compiling a kernel with both FAIR_GROUP_SCHED=n and RT_GROUP_SCHED=n
will generate a warning using W=1,

kernel/sched/core.c: In function 'sched_init':
kernel/sched/core.c:5906:32: warning: variable 'ptr' set but not used
[-Wunused-but-set-variable]
  unsigned long alloc_size = 0, ptr;
                                ^~~

It apparently the maintainers don't like the proper fix [1] which
contains ugly idefs, so silence it by appending the __maybe_unused
attribute for it instead.

[1] https://lore.kernel.org/lkml/1559681162-5385-1-git-send-email-cai@lca.pw/

Signed-off-by: Qian Cai <cai@....pw>
---
 kernel/sched/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 874c427742a9..9bbad91b3f01 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5903,7 +5903,10 @@ int in_sched_functions(unsigned long addr)
 void __init sched_init(void)
 {
 	int i, j;
-	unsigned long alloc_size = 0, ptr;
+	unsigned long alloc_size = 0;
+
+	/* To silence a -Wunused-but-set-variable warning. */
+	unsigned long ptr __maybe_unused;
 
 	wait_bit_init();
 
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ