netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tim Hansen <devtimhansen@gmail.com>
To: davem@davemloft.net
Cc: willemb@google.com, edumazet@google.com, soheil@google.com,
	elena.reshetova@intel.com, pabeni@redhat.com, tom@quantonium.net,
	Jason@zx2c4.com, fw@strlen.de, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, alexander.levin@one.verizon.com
Subject: Re: [PATCH v2] net/core: Fix BUG to BUG_ON conditionals.
Date: Sun, 8 Oct 2017 16:03:38 -0400	[thread overview]
Message-ID: <20171008200338.2noygmfbdri6lc4y@debian> (raw)
In-Reply-To: <20171008191720.prewqllyazdstwkp@debian>

Mistakenly sent the patch previously with a missing semicolon.
Apologies.

Fix BUG() calls to use BUG_ON(conditional) macros.

This was found using make coccicheck M=net/core on linux next
tag next-20170929

Signed-off-by: Tim Hansen <devtimhansen@gmail.com>
---
 net/core/skbuff.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index d98c2e3ce2bf..34ce4c1a0f3c 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1350,8 +1350,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;
@@ -1449,8 +1448,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);
 
@@ -1595,9 +1593,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);
 
@@ -1878,8 +1875,8 @@ void *__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.
-- 
2.14.2

  reply	other threads:[~2017-10-08 20:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-08 19:17 [PATCH] net/core: Fix BUG to BUG_ON conditionals Tim Hansen
2017-10-08 20:03 ` Tim Hansen [this message]
2017-10-09  4:20   ` [PATCH v2] " David Miller
2017-10-08 23:52 ` [PATCH] " kbuild test robot
2017-10-09  6:45 ` kbuild test robot
  -- strict thread matches above, loose matches on Subject: below --
2017-10-09 15:37 [PATCH v2] " Tim Hansen
2017-10-09 17:15 ` Alexei Starovoitov
2017-10-09 20:26   ` Levin, Alexander (Sasha Levin)
2017-10-09 23:06     ` Alexei Starovoitov
2017-10-09 23:15       ` Levin, Alexander (Sasha Levin)
2017-10-09 23:23         ` Alexei Starovoitov
2017-10-10  1:14           ` Levin, Alexander (Sasha Levin)
2017-10-09 23:17       ` David Miller
2017-10-10 19:32 ` 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=20171008200338.2noygmfbdri6lc4y@debian \
    --to=devtimhansen@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=alexander.levin@one.verizon.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=elena.reshetova@intel.com \
    --cc=fw@strlen.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=soheil@google.com \
    --cc=tom@quantonium.net \
    --cc=willemb@google.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;
as well as URLs for NNTP newsgroup(s).