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: <Ygp64CsyyKyRykqE@dev-arch.archlinux-ax161>
Date:   Mon, 14 Feb 2022 08:53:04 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Steven Rostedt <rostedt@...dmis.org>
Cc:     kernel test robot <lkp@...el.com>,
        chongjiapeng <jiapeng.chong@...ux.alibaba.com>,
        llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: Re: kernel/trace/ftrace.c:7157:20: error: unused function
 'ftrace_startup_enable'

Hi Steve,

On Mon, Feb 14, 2022 at 10:20:00AM -0500, Steven Rostedt wrote:
> On Sun, 13 Feb 2022 21:03:29 +0800
> kernel test robot <lkp@...el.com> wrote:
> 
> > All errors (new ones prefixed by >>):
> > 
> > >> kernel/trace/ftrace.c:7157:20: error: unused function 'ftrace_startup_enable' [-Werror,-Wunused-function]  
> >    static inline void ftrace_startup_enable(int command) { }
> >                       ^
> >    1 error generated.
> 
> Strange. I always thought that static inline functions do not cause
> warnings when not used? Especially, since they are often in headers when
> things are turned off. Or is it because this is in a C file?

With -Wunused-function, clang will warn about unused static inline
functions within a .c file (but not .h), whereas GCC will not warn for
either. The unused attribute was added to the definition of inline to
make clang's behavior match GCC's.

> Is this a new warning caused by a commit, or is it a new warning because
> the compiler now complains about it?

However, in commit 6863f5643dd7 ("kbuild: allow Clang to find unused
static inline functions for W=1 build"), Masahiro made it so that the
unused attribute does not get added at W=1 so that instances of unused
static inline functions can be caught and eliminated (or put into use,
if the function should have been used), hence this report.

I will be honest, I don't know why the robot flagged 172f7ba9772c as the
commit that introduced this warning but it seems legitimate if
CONFIG_DYNAMIC_FTRACE is not enabled, since ftrace_startup_enable() is
only ever used within an '#ifdef CONFIG_DYNAMIC_FTRACE' block so I guess
the stub is unnecessary?

Cheers,
Nathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ