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  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 20 Sep 2021 13:18:53 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Stephen Rothwell <sfr@...b.auug.org.au>
Cc:     Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...e.hu>,
        "H. Peter Anvin" <hpa@...or.com>,
        Yafang Shao <laoar.shao@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux Next Mailing List <linux-next@...r.kernel.org>
Subject: Re: linux-next: build warning after merge of the tip tree

On Mon, Sep 20, 2021 at 11:33:30AM +1000, Stephen Rothwell wrote:
> Hi all,
> 
> After merging the tip tree, today's linux-next build (powerpc_ppc64
> defconfig) produced this warning:
> 
> kernel/sched/debug.c: In function 'print_cfs_group_stats':
> kernel/sched/debug.c:460:41: warning: unused variable 'stats' [-Wunused-variable]
>   460 |                struct sched_statistics *stats =  __schedstats_from_se(se);
>       |                                         ^~~~~
> 

So I've not seen that one *yet*, I've dont a bunch of SCHEDSTAT=n
builds. I do think GCC is being quite stupid for giving it, seeing how
the whole thing is within if (0). The GCC people seem to disagree when I
brought it up.

Anyway, what I did in other parts was the below; that seems to 'upgrade'
the warnings from -Wunused-variable to -Wunused-but-set-variable, and
that latter *is* in W=1, and I'm arguing it should be promoted to W=2 or
thereabout.

Given that whole if(0) {} thing, I don't feel motivated to change things
overly much and quite strongly feel this is the compiler being daft.

---

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 935dad7dffb7..ef71de01e4d7 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -457,7 +457,8 @@ static void print_cfs_group_stats(struct seq_file *m, int cpu, struct task_group
 	PN(se->sum_exec_runtime);
 
 	if (schedstat_enabled()) {
-               struct sched_statistics *stats =  __schedstats_from_se(se);
+		struct sched_statistics *stats;
+		stats = __schedstats_from_se(se);
 
 		PN_SCHEDSTAT(wait_start);
 		PN_SCHEDSTAT(sleep_start);

Powered by blists - more mailing lists