From patchwork Mon Mar 30 21:13:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 456344 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D082A1400B6 for ; Tue, 31 Mar 2015 08:16:50 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753419AbbC3VNc (ORCPT ); Mon, 30 Mar 2015 17:13:32 -0400 Received: from mailrelay107.isp.belgacom.be ([195.238.20.134]:48291 "EHLO mailrelay107.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753378AbbC3VNb (ORCPT ); Mon, 30 Mar 2015 17:13:31 -0400 X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=pojTLeLEEG+IB9MeyQ9xnWKWJHiyH+4Hnj5iAYu/pCk= c=1 sm=2 a=l_8wjznChqUSy7SNfXMA:9 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2CzBgDBuxlV/yA2QFdcgwaBLrIWAQEBAQEBBQF7mBYCgTxNAQEBAQEBfYQVAQUnLyMQUTkeGYgzAcwMAQEBByKGD4oSBxaEFwWaUIs7iHoig3A8MYJDAQEB Received: from 32.54-64-87.adsl-dyn.isp.belgacom.be (HELO localhost.home.) ([87.64.54.32]) by relay.skynet.be with ESMTP; 30 Mar 2015 23:13:30 +0200 From: Fabian Frederick To: linux-kernel@vger.kernel.org Cc: Fabian Frederick , "David S. Miller" , 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 Message-Id: <1427749998-28464-2-git-send-email-fabf@skynet.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427749998-28464-1-git-send-email-fabf@skynet.be> References: <1427749998-28464-1-git-send-email-fabf@skynet.be> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Fabian Frederick --- 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.