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] [day] [month] [year] [list]
Date:   Fri, 1 Mar 2019 21:40:42 +0100
From:   Michal Kubecek <mkubecek@...e.cz>
To:     Nick Desaulniers <ndesaulniers@...gle.com>
Cc:     netdev@...r.kernel.org,
        Nathan Chancellor <natechancellor@...il.com>,
        Sasha Neftin <sasha.neftin@...el.com>,
        Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
        Aaron Brown <aaron.f.brown@...el.com>,
        intel-wired-lan@...ts.osuosl.org,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: Clang warning in drivers/net/ethernet/intel/igc/igc_ethtool.c

On Fri, Mar 01, 2019 at 10:28:35AM -0800, Nick Desaulniers wrote:
> On Fri, Feb 8, 2019 at 6:34 AM Michal Kubecek <mkubecek@...e.cz> wrote:
> >
> > On Thu, Feb 07, 2019 at 10:09:21PM -0700, Nathan Chancellor wrote:
> > > Hi all,
> > >
> > > After commit 8c5ad0dae93c ("igc: Add ethtool support"), Clang warns:
> > >
> > > drivers/net/ethernet/intel/igc/igc_ethtool.c:9:19: warning: variable 'igc_priv_flags_strings' is not needed and will not be emitted [-Wunneeded-internal-declaration]
> > > static const char igc_priv_flags_strings[][ETH_GSTRING_LEN] = {
> > >                   ^
> > > 1 warning generated.
> > >
> > > igc_priv_flags_strings is only used in an ARRAY_SIZE macro, which is a
> > > compile time evaluation, so no reference to it is being emitted in the
> > > final assembly. Is it actually needed and was forgotten to be used
> > > somewhere or could it be eliminated so that Clang no longer warns?
> >
> > That's because the driver provides get_priv_flags() and set_priv_flags()
> > callbacks in its ethtool_ops to allow querying and setting legacy-rx
> > private flag but it does not provide get_sset_count() and get_strings()
> > to provide list of private flags to userspace ethtool.
> 
> So the variable declaration should get a `__unused` annotation then
> (and maybe a comment)?

I would rather suggest to add missing ethtool_ops handlers so that the
flag can be actually shown and set using ethtool.

Michal Kubecek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ