From: Julia Lawall <julia.lawall@lip6.fr>
To: Fabian Frederick <fabf@skynet.be>
Cc: "J. Bruce Fields" <bfields@fieldses.org>,
Trond Myklebust <trond.myklebust@primarydata.com>,
linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Anna Schumaker <anna.schumaker@netapp.com>,
Julia Lawall <Julia.Lawall@lip6.fr>
Subject: Re: [PATCH 7/9 net-next] sunrpc: replace if/BUG by BUG_ON
Date: Tue, 31 Mar 2015 21:11:31 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1503312110240.2115@localhost6.localdomain6> (raw)
In-Reply-To: <256862218.214616.1427828441666.open-xchange@webmail.nmp.proximus.be>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 3258 bytes --]
On Tue, 31 Mar 2015, Fabian Frederick wrote:
>
>
> > On 30 March 2015 at 23:25 "J. Bruce Fields" <bfields@fieldses.org> wrote:
> >
> >
> > Huh, I thought this wasn't recommended:
> >
> > http://lkml.kernel.org/r/20040828125816.206ef7fa.akpm@osdl.org
> >
> > "I'd prefer that we not move code which has side-effects into
> > BUG_ONs"
>
> Thanks for the link, I wasn't aware of that problem. Maybe we should add some
> documentation and fix coccinelle detection then ?
Maybe the comment in the Coccinelle rule could just be made more clear?
The only practical choices are to ignore all function calls and to allow
all fuction calls, since Coccinelle doesn't know which ones have side
effects.
julia
> Regards,
> Fabian
>
> >
> > --b.
> >
> > On Mon, Mar 30, 2015 at 11:13:15PM +0200, Fabian Frederick wrote:
> > > Signed-off-by: Fabian Frederick <fabf@skynet.be>
> > > ---
> > > net/sunrpc/auth_gss/svcauth_gss.c | 9 +++------
> > > net/sunrpc/svc_xprt.c | 3 +--
> > > 2 files changed, 4 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/net/sunrpc/auth_gss/svcauth_gss.c
> > > b/net/sunrpc/auth_gss/svcauth_gss.c
> > > index 1095be9..09f8a1c6 100644
> > > --- a/net/sunrpc/auth_gss/svcauth_gss.c
> > > +++ b/net/sunrpc/auth_gss/svcauth_gss.c
> > > @@ -840,11 +840,9 @@ unwrap_integ_data(struct svc_rqst *rqstp, struct
> > > xdr_buf *buf, u32 seq, struct g
> > > return stat;
> > > if (integ_len > buf->len)
> > > return stat;
> > > - if (xdr_buf_subsegment(buf, &integ_buf, 0, integ_len))
> > > - BUG();
> > > + BUG_ON(xdr_buf_subsegment(buf, &integ_buf, 0, integ_len));
> > > /* copy out mic... */
> > > - if (read_u32_from_xdr_buf(buf, integ_len, &mic.len))
> > > - BUG();
> > > + BUG_ON(read_u32_from_xdr_buf(buf, integ_len, &mic.len));
> > > if (mic.len > RPC_MAX_AUTH_SIZE)
> > > return stat;
> > > mic.data = kmalloc(mic.len, GFP_KERNEL);
> > > @@ -1595,8 +1593,7 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp)
> > > BUG_ON(integ_len % 4);
> > > *p++ = htonl(integ_len);
> > > *p++ = htonl(gc->gc_seq);
> > > - if (xdr_buf_subsegment(resbuf, &integ_buf, integ_offset, integ_len))
> > > - BUG();
> > > + BUG_ON(xdr_buf_subsegment(resbuf, &integ_buf, integ_offset, integ_len));
> > > if (resbuf->tail[0].iov_base == NULL) {
> > > if (resbuf->head[0].iov_len + RPC_MAX_AUTH_SIZE > PAGE_SIZE)
> > > goto out_err;
> > > diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
> > > index 163ac45..2f82e8b 100644
> > > --- a/net/sunrpc/svc_xprt.c
> > > +++ b/net/sunrpc/svc_xprt.c
> > > @@ -960,8 +960,7 @@ static void svc_delete_xprt(struct svc_xprt *xprt)
> > > struct svc_deferred_req *dr;
> > >
> > > /* Only do this once */
> > > - if (test_and_set_bit(XPT_DEAD, &xprt->xpt_flags))
> > > - BUG();
> > > + BUG_ON(test_and_set_bit(XPT_DEAD, &xprt->xpt_flags));
> > >
> > > dprintk("svc: svc_delete_xprt(%p)\n", xprt);
> > > xprt->xpt_ops->xpo_detach(xprt);
> > > --
> > > 1.9.1
>
next prev parent reply other threads:[~2015-03-31 19:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-30 21:13 [PATCH 1/9 net-next] ipv4: " Fabian Frederick
2015-03-30 21:13 ` [PATCH 2/9 net-next] net: core: " Fabian Frederick
2015-03-30 21:13 ` [PATCH 3/9 net-next] af_key: " Fabian Frederick
2015-03-30 21:13 ` [PATCH 4/9 net-next] ipv6: " Fabian Frederick
2015-03-31 3:50 ` YOSHIFUJI Hideaki
2015-03-31 15:17 ` David Miller
2015-04-03 20:02 ` Fabian Frederick
2015-03-30 21:13 ` [PATCH 5/9 net-next] xfrm: " Fabian Frederick
2015-03-30 21:13 ` [PATCH 6/9 net-next] af_packet: " Fabian Frederick
2015-03-30 21:13 ` [PATCH 7/9 net-next] sunrpc: " Fabian Frederick
2015-03-30 21:25 ` J. Bruce Fields
2015-03-31 19:00 ` Fabian Frederick
2015-03-31 19:11 ` Julia Lawall [this message]
2015-03-31 20:13 ` Fabian Frederick
2015-03-30 21:13 ` [PATCH 8/9 net-next] rxrpc: " Fabian Frederick
2015-03-30 21:13 ` [PATCH 9/9 net-next] netfilter: " Fabian Frederick
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=alpine.DEB.2.02.1503312110240.2115@localhost6.localdomain6 \
--to=julia.lawall@lip6.fr \
--cc=anna.schumaker@netapp.com \
--cc=bfields@fieldses.org \
--cc=davem@davemloft.net \
--cc=fabf@skynet.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
/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
all inboxes | Powered by JetHome®