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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 08 Sep 2020 19:09:00 +0300
From:   nikolay@...ulusnetworks.com
To:     Jakub Kicinski <kuba@...nel.org>
CC:     netdev@...r.kernel.org, davem@...emloft.net, roopa@...dia.com,
        Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH net-next] net: bridge: mcast: fix unused br var when lockdep isn't defined

On 8 September 2020 19:00:49 EEST, Jakub Kicinski <kuba@...nel.org> wrote:
>On Tue,  8 Sep 2020 10:17:13 +0300 Nikolay Aleksandrov wrote:
>> Stephen reported the following warning:
>>  net/bridge/br_multicast.c: In function 'br_multicast_find_port':
>>  net/bridge/br_multicast.c:1818:21: warning: unused variable 'br'
>[-Wunused-variable]
>>   1818 |  struct net_bridge *br = mp->br;
>>        |                     ^~
>> 
>> It happens due to bridge's mlock_dereference() when lockdep isn't
>defined.
>> Silence the warning by annotating the variable as __maybe_unused.
>> 
>> Fixes: 0436862e417e ("net: bridge: mcast: support for IGMPv3/MLDv2
>ALLOW_NEW_SOURCES report")
>> Reported-by: Stephen Rothwell <sfr@...b.auug.org.au>
>> Signed-off-by: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
>> ---
>>  net/bridge/br_multicast.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
>> index b83f11228948..33adf44ef7ec 100644
>> --- a/net/bridge/br_multicast.c
>> +++ b/net/bridge/br_multicast.c
>> @@ -1814,8 +1814,8 @@ br_multicast_find_port(struct
>net_bridge_mdb_entry *mp,
>>  		       struct net_bridge_port *p,
>>  		       const unsigned char *src)
>>  {
>> +	struct net_bridge *br __maybe_unused = mp->br;
>>  	struct net_bridge_port_group *pg;
>> -	struct net_bridge *br = mp->br;
>>  
>>  	for (pg = mlock_dereference(mp->ports, br);
>>  	     pg;
>
>That's a lazy fix :( Is everyone using lockdep annotations going to
>sprinkle __maybe_unused throughout the code? Macros should also always
>evaluate their arguments.

When the local variable's only used for lockdep, I guess. :) 
Here we don't actually need it at all, alternatively we can just drop it and use mp->br. 

Powered by blists - more mailing lists