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] [day] [month] [year] [list]
Date:   Wed, 8 Jan 2020 22:40:47 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     David Miller <davem@...emloft.net>
Cc:     Kirill Tkhai <ktkhai@...tuozzo.com>, Jens Axboe <axboe@...nel.dk>,
        Willem de Bruijn <willemb@...gle.com>,
        Deepa Dinamani <deepa.kernel@...il.com>,
        Johannes Berg <johannes.berg@...el.com>,
        Al Viro <viro@...iv.linux.org.uk>, pctammela@...il.com,
        Networking <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] [net-next] socket: fix unused-function warning

On Wed, Jan 8, 2020 at 10:27 PM David Miller <davem@...emloft.net> wrote:
>
> From: Arnd Bergmann <arnd@...db.de>
> Date: Tue,  7 Jan 2020 22:35:59 +0100
>
> > When procfs is disabled, the fdinfo code causes a harmless
> > warning:
> >
> > net/socket.c:1000:13: error: 'sock_show_fdinfo' defined but not used [-Werror=unused-function]
> >  static void sock_show_fdinfo(struct seq_file *m, struct file *f)
> >
> > Change the preprocessor conditional to a compiler conditional
> > to avoid the warning and let the compiler throw away the
> > function itself.
> >
> > Fixes: b4653342b151 ("net: Allow to show socket-specific information in /proc/[pid]/fdinfo/[fd]")
> > Signed-off-by: Arnd Bergmann <arnd@...db.de>
>
> This isn't the prettiest thing I've ever seen.
>
> I really think it's nicer to just explicitly put ifdef's around the
> forward declaration and the implementation of sock_show_fdinfo().
>
> Alternatively, move the implementation up to the location of the
> forward declaration and then you just need one new ifdef guard.

My first version just had a __maybe_unused tag on the declaration, but
I was hoping this would be nicer as it avoids the #ifdef.

I'll send the version Al suggested instead, unless you prefer the
__maybe_unused.

      Arnd

Powered by blists - more mailing lists