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]
Message-ID: <Y/Hsj/HW4rl2rFMf@unreal>
Date:   Sun, 19 Feb 2023 11:31:59 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     Edward Cree <ecree.xilinx@...il.com>
Cc:     Arnd Bergmann <arnd@...nel.org>,
        Martin Habets <habetsm.xilinx@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Alejandro Lucero <alejandro.lucero-palau@....com>,
        Arnd Bergmann <arnd@...db.de>,
        Jonathan Cooper <jonathan.s.cooper@....com>,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sfc: use IS_ENABLED() checks for CONFIG_SFC_SRIOV

On Fri, Feb 17, 2023 at 04:13:59PM +0000, Edward Cree wrote:
> On 17/02/2023 09:56, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@...db.de>
> > 
> > One local variable has become unused after a recent change:
> > 
> > drivers/net/ethernet/sfc/ef100_nic.c: In function 'ef100_probe_netdev_pf':
> > drivers/net/ethernet/sfc/ef100_nic.c:1155:21: error: unused variable 'net_dev' [-Werror=unused-variable]
> >   struct net_device *net_dev = efx->net_dev;
> >                      ^~~~~~~
> > 
> > The variable is still used in an #ifdef. Replace the #ifdef with
> > an if(IS_ENABLED()) check that lets the compiler see where it is
> > used, rather than adding another #ifdef.
> 
> So we've had Leon telling us[1] to use __maybe_unused, and you're
>  saying to use IS_ENABLED() instead.  Which is right?
> (And does it make any difference to build time?  I'm assuming the
>  compiler is smart enough that this change doesn't affect text
>  size...?)

You are mixing answers, __maybe_unused is for variables. For functions,
it will be much saner to create empty declarations for relevant
functions in tc.h, for !CONFIG_SFC_SRIOV flow.

It will be much cleaner than spaghetti code in .c files which you have now.

Thanks

> -ed
> 
> [1]: https://lore.kernel.org/netdev/cac3fa89-50a3-6de0-796c-a215400f3710@intel.com/T/#md2ecc82f18c200391dc6581ff68ff08eee9a65cf

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ