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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 22 Apr 2021 07:01:47 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Peter Zijlstra <peterz@...radead.org>,
        Steven Rostedt <rostedt@...dmis.org>
Cc:     Josh Poimboeuf <jpoimboe@...hat.com>,
        Jason Baron <jbaron@...mai.com>,
        Ard Biesheuvel <ardb@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] static_call: Fix unused variable warning

On 4/22/21 12:20 AM, Peter Zijlstra wrote:
> On Wed, Apr 21, 2021 at 08:41:39PM -0400, Steven Rostedt wrote:
>>
>> Second patch with the exact same update. Perhaps we should take one
>> before we get more of them ;-)
>>
> 
> I thought we already fixed that...

Not in v5.12-rc8-6-g4bdafe832681, which is ToT right now.

Ah, I do see it in -next, but that doesn't help me in mainline,
nor in stable branches where the patch introducing the problem
has been backported to.

Guenter

> 
> ---
> commit 7d95f22798ecea513f37b792b39fec4bcf20fec3
> Author: Matthieu Baerts <matthieu.baerts@...sares.net>
> Date:   Fri Mar 26 11:50:23 2021 +0100
> 
>     static_call: Fix unused variable warn w/o MODULE
>     
>     Here is the warning converted as error and reported by GCC:
>     
>       kernel/static_call.c: In function ‘__static_call_update’:
>       kernel/static_call.c:153:18: error: unused variable ‘mod’ [-Werror=unused-variable]
>         153 |   struct module *mod = site_mod->mod;
>             |                  ^~~
>       cc1: all warnings being treated as errors
>       make[1]: *** [scripts/Makefile.build:271: kernel/static_call.o] Error 1
>     
>     This is simply because since recently, we no longer use 'mod' variable
>     elsewhere if MODULE is unset.
>     
>     When using 'make tinyconfig' to generate the default kconfig, MODULE is
>     unset.
>     
>     There are different ways to fix this warning. Here I tried to minimised
>     the number of modified lines and not add more #ifdef. We could also move
>     the declaration of the 'mod' variable inside the if-statement or
>     directly use site_mod->mod.
>     
>     Fixes: 698bacefe993 ("static_call: Align static_call_is_init() patching condition")
>     Signed-off-by: Matthieu Baerts <matthieu.baerts@...sares.net>
>     Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
>     Link: https://lkml.kernel.org/r/20210326105023.2058860-1-matthieu.baerts@tessares.net
> 
> diff --git a/kernel/static_call.c b/kernel/static_call.c
> index 2c5950b0b90e..723fcc9d20db 100644
> --- a/kernel/static_call.c
> +++ b/kernel/static_call.c
> @@ -165,13 +165,13 @@ void __static_call_update(struct static_call_key *key, void *tramp, void *func)
>  
>  		stop = __stop_static_call_sites;
>  
> -#ifdef CONFIG_MODULES
>  		if (mod) {
> +#ifdef CONFIG_MODULES
>  			stop = mod->static_call_sites +
>  			       mod->num_static_call_sites;
>  			init = mod->state == MODULE_STATE_COMING;
> -		}
>  #endif
> +		}
>  
>  		for (site = site_mod->sites;
>  		     site < stop && static_call_key(site) == key; site++) {
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ