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: <CAK8P3a30a1SKh+71+EgPmsJ1FKJTPKYQuAFUebwKKrhuVzBh3Q@mail.gmail.com>
Date:   Mon, 20 Sep 2021 14:48:23 +0200
From:   Arnd Bergmann <arnd@...nel.org>
To:     Christoph Hellwig <hch@...radead.org>
Cc:     Jens Axboe <axboe@...nel.dk>,
        Pavel Begunkov <asml.silence@...il.com>,
        Arnd Bergmann <arnd@...db.de>, io-uring@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] [RFC] io_uring: warning about unused-but-set parameter

On Mon, Sep 20, 2021 at 2:18 PM Christoph Hellwig <hch@...radead.org> wrote:
>
> On Mon, Sep 20, 2021 at 02:13:44PM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@...db.de>
> >
> > When enabling -Wunused warnings by building with W=1, I get an
> > instance of the -Wunused-but-set-parameter warning in the io_uring code:
> >
> > fs/io_uring.c: In function 'io_queue_async_work':
> > fs/io_uring.c:1445:61: error: parameter 'locked' set but not used [-Werror=unused-but-set-parameter]
> >  1445 | static void io_queue_async_work(struct io_kiocb *req, bool *locked)
> >       |                                                       ~~~~~~^~~~~~
> >
> > There are very few warnings of this type, so it would be nice to enable
> > this by default and fix all the existing instances. I was almost
> > done, but this was added recently as a precaution to prevent code
> > from using the parameter, which could be done by either removing
> > the initialization, or by adding a (fake) use of the variable, which
> > I do here with the cast to void.
>
> Please don't.  These warning are utterly stupid and should not be
> enabled.  For anything that is a "method" of sorts (that is assigned
> to a function pointer), unused argument are perfectly normal.

I'm not suggesting to enable -Wunused-parameter, which would be
complete madness of crouse, only -Wunused-but-set-parameter,
which is already part of W=1 and has the potential of catching
actual bugs such as

int f(int val)
{
      if (val = 1)
            return 0;

       return -1;
}

          Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ