linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Miguel Ojeda <ojeda@kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH v2] ELF: add and use SUPPRESS_WARN_UNUSED_RESULT
Date: Sat, 26 Jun 2021 09:40:59 +0300	[thread overview]
Message-ID: <YNbL+2dIVeZlNo6V@localhost.localdomain> (raw)
In-Reply-To: <20210625163040.a15af04872959da9af161fca@linux-foundation.org>

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@gmail.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);

      parent reply	other threads:[~2021-06-26  6:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25 19:52 [PATCH] ELF: add and use SUPRESS_WARN_UNUSED_RESULT Alexey Dobriyan
2021-06-25 20:34 ` Miguel Ojeda
2021-06-25 21:10   ` Alexey Dobriyan
2021-06-25 21:11     ` Randy Dunlap
2021-06-25 21:57     ` Miguel Ojeda
2021-06-26  6:44       ` [PATCH] ELF: add and use SUPRESS_WARN_UNUSED_RESULT\ Alexey Dobriyan
2021-06-26 14:29         ` Miguel Ojeda
2021-06-25 21:13 ` [PATCH v2] ELF: add and use SUPPRESS_WARN_UNUSED_RESULT Alexey Dobriyan
2021-06-25 23:30   ` Andrew Morton
2021-06-26  2:05     ` Linus Torvalds
2021-06-26  2:37       ` Al Viro
2021-06-26  3:13         ` Linus Torvalds
2021-06-26  6:40     ` Alexey Dobriyan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YNbL+2dIVeZlNo6V@localhost.localdomain \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH v2] ELF: add and use SUPPRESS_WARN_UNUSED_RESULT' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).