From: Steffen Klassert <steffen.klassert@secunet.com>
To: David Miller <davem@davemloft.net>
Cc: <herbert@gondor.apana.org.au>, <garsilva@embeddedor.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: xfrm_user: use BUG_ON instead of if condition followed by BUG
Date: Wed, 25 Oct 2017 09:28:00 +0200 [thread overview]
Message-ID: <20171025072800.GQ3323@secunet.com> (raw)
In-Reply-To: <20171025.132222.1438740282932861791.davem@davemloft.net>
On Wed, Oct 25, 2017 at 01:22:22PM +0900, David Miller wrote:
> From: Herbert Xu <herbert@gondor.apana.org.au>
> Date: Wed, 25 Oct 2017 12:05:41 +0800
>
> > On Tue, Oct 24, 2017 at 05:48:42PM +0900, David Miller wrote:
> >>
> >> This discussion has happened before.
> >>
> >> But I'll explain the conclusion here for your benefit.
> >>
> >> BUG_ON() is a statement and everything inside of it will
> >> always execute.
> >>
> >> BUG_ON() is always preferred because it allows arch
> >> specific code to pass the conditional result properly
> >> into inline asm and builtins for optimal code generation.
> >
> > This is a good point. However, while a little bit more verbose you
> > can still achieve the same assembly-level result by something like
> >
> > int err;
> >
> > err = <insert real code here>;
> > BUG_ON(err);
> >
> > Having real code in BUG_ON may pose problems to people reading the
> > code because some of us tend to ignore code in BUG_ON and similar
> > macros such as BUILD_BUG_ON.
>
> I agree that this makes the code easier to read and audit.
It seems that we have an agreement on the above version,
Gustavo can you please update your patches to this?
Thanks!
next prev parent reply other threads:[~2017-10-25 7:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-23 18:18 [PATCH] net: xfrm_user: use BUG_ON instead of if condition followed by BUG Gustavo A. R. Silva
2017-10-24 3:25 ` Herbert Xu
2017-10-24 3:50 ` Gustavo A. R. Silva
2017-10-24 3:53 ` Herbert Xu
2017-10-24 3:57 ` Gustavo A. R. Silva
2017-10-24 4:01 ` Alexei Starovoitov
2017-10-24 4:30 ` Herbert Xu
2017-10-24 8:48 ` David Miller
2017-10-25 4:05 ` Herbert Xu
2017-10-25 4:22 ` David Miller
2017-10-25 7:28 ` Steffen Klassert [this message]
2017-10-25 16:43 ` Gustavo A. R. Silva
2017-10-26 0:38 ` Gustavo A. R. Silva
2017-10-26 6:36 ` Herbert Xu
2017-10-26 10:47 ` Gustavo A. R. Silva
2017-10-26 11:31 ` [PATCH v2] " Gustavo A. R. Silva
2017-10-27 10:46 ` Steffen Klassert
2017-10-27 20:56 ` Gustavo A. R. Silva
2017-10-24 8:47 ` [PATCH] " David Miller
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=20171025072800.GQ3323@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=davem@davemloft.net \
--cc=garsilva@embeddedor.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).