From: Fabian Frederick <fabf@skynet.be>
To: linux-kernel@vger.kernel.org
Cc: Fabian Frederick <fabf@skynet.be>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: [PATCH 2/9 net-next] net: core: replace if/BUG by BUG_ON
Date: Mon, 30 Mar 2015 23:13:10 +0200 [thread overview]
Message-ID: <1427749998-28464-2-git-send-email-fabf@skynet.be> (raw)
In-Reply-To: <1427749998-28464-1-git-send-email-fabf@skynet.be>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
net/core/rtnetlink.c | 3 +--
net/core/skbuff.c | 15 ++++++---------
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index b96ac21..ed496d3 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1770,8 +1770,7 @@ static int do_setlink(const struct sk_buff *skb,
nla_for_each_nested(af, tb[IFLA_AF_SPEC], rem) {
const struct rtnl_af_ops *af_ops;
- if (!(af_ops = rtnl_af_lookup(nla_type(af))))
- BUG();
+ BUG_ON(!(af_ops = rtnl_af_lookup(nla_type(af))));
err = af_ops->set_link_af(dev, af);
if (err < 0)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index cdb939b..704ba4d 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1056,8 +1056,7 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
/* Set the tail pointer and length */
skb_put(n, skb->len);
- if (skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len))
- BUG();
+ BUG_ON(skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len));
copy_skb_header(n, skb);
return n;
@@ -1154,8 +1153,7 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
BUG_ON(nhead < 0);
- if (skb_shared(skb))
- BUG();
+ BUG_ON(skb_shared(skb));
size = SKB_DATA_ALIGN(size);
@@ -1289,9 +1287,8 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
head_copy_off = newheadroom - head_copy_len;
/* Copy the linear header and data. */
- if (skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
- skb->len + head_copy_len))
- BUG();
+ BUG_ON(skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
+ skb->len + head_copy_len));
copy_skb_header(n, skb);
@@ -1567,8 +1564,8 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
return NULL;
}
- if (skb_copy_bits(skb, skb_headlen(skb), skb_tail_pointer(skb), delta))
- BUG();
+ BUG_ON(skb_copy_bits(skb, skb_headlen(skb), skb_tail_pointer(skb),
+ delta));
/* Optimization: no fragments, no reasons to preestimate
* size of pulled pages. Superb.
--
1.9.1
next prev parent reply other threads:[~2015-03-30 21:13 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: replace if/BUG by BUG_ON Fabian Frederick
2015-03-30 21:13 ` Fabian Frederick [this message]
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
[not found] ` <256862218.214616.1427828441666.open-xchange-2RFepEojUI2qqBEoxdIGPtE3N/6ypZDY@public.gmane.org>
2015-03-31 19:11 ` Julia Lawall
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=1427749998-28464-2-git-send-email-fabf@skynet.be \
--to=fabf@skynet.be \
--cc=davem@davemloft.net \
--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).