[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNbL+2dIVeZlNo6V@localhost.localdomain>
Date: Sat, 26 Jun 2021 09:40:59 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, Miguel Ojeda <ojeda@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH v2] ELF: add and use SUPPRESS_WARN_UNUSED_RESULT
On Fri, Jun 25, 2021 at 04:30:40PM -0700, Andrew Morton wrote:
> On Sat, 26 Jun 2021 00:13:12 +0300 Alexey Dobriyan <adobriyan@...il.com> wrote:
>
> > Last write to the "error" variable in load_elf_binary() is dead write.
> >
> > Add and use SUPPRESS_WARN_UNUSED_RESULT macro to express intent better.
> >
> > Credit goes to Ed Catmur:
> >
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425#c34
> >
> > Macro doesn't work for WUR functions returning structures and unions,
> > but it will work when gcc copies clang.
> >
> > ...
> >
> > #define __must_check __attribute__((__warn_unused_result__))
> > +/*
> > + * "(void)" is enough for clang but not for gcc.
> > + */
> > +#define SUPPRESS_WARN_UNUSED_RESULT (void)!
>
> That macro is rather ugly. Hopefully we won't really need it - how
> many such sites are there in a full kernel build anyway?
I don't know really. And they're hard to find because "(void)" doesn't
work and not everything is marked as WUR.
copy_from_user/copy_to_user are WUR but get_user/put_user aren't.
Logically they should bed. And if put_user() is WUR then I know another
place inside fork:
if (clone_flags & CLONE_PARENT_SETTID)
put_user(nr, args->parent_tid);
Powered by blists - more mailing lists