]> err.no Git - linux-2.6/commitdiff
[NET]: Change some "if (x) BUG();" to "BUG_ON(x);"
authorKris Katterjohn <kjak@users.sourceforge.net>
Mon, 9 Jan 2006 06:24:28 +0000 (22:24 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 9 Jan 2006 22:16:18 +0000 (14:16 -0800)
This changes some simple "if (x) BUG();" statements to "BUG_ON(x);"

Signed-off-by: Kris Katterjohn <kjak@users.sourceforge.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c
net/core/skbuff.c
net/ipv4/icmp.c
net/ipv4/inetpeer.c
net/ipv4/tcp_input.c
net/key/af_key.c
net/sctp/sm_sideeffect.c
net/sunrpc/cache.c
net/sunrpc/svc.c
net/xfrm/xfrm_algo.c
net/xfrm/xfrm_policy.c

index 5081287923d52dce220fa21a3fb1b3a0f81a354a..bf66b114d3c235b24457bc588d34a12e60b7ffd5 100644 (file)
@@ -1092,15 +1092,12 @@ int skb_checksum_help(struct sk_buff *skb, int inward)
                        goto out;
        }
 
-       if (offset > (int)skb->len)
-               BUG();
+       BUG_ON(offset > (int)skb->len);
        csum = skb_checksum(skb, offset, skb->len-offset, 0);
 
        offset = skb->tail - skb->h.raw;
-       if (offset <= 0)
-               BUG();
-       if (skb->csum + 2 > offset)
-               BUG();
+       BUG_ON(offset <= 0);
+       BUG_ON(skb->csum + 2 > offset);
 
        *(u16*)(skb->h.raw + skb->csum) = csum_fold(csum);
        skb->ip_summed = CHECKSUM_NONE;
index 070f91cfde598cf20c20b1b291479a832922657b..d0732e9c8560e10d8ec239957fa3b8d4d3c1df00 100644 (file)
@@ -791,8 +791,7 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc)
                int end = offset + skb_shinfo(skb)->frags[i].size;
                if (end > len) {
                        if (skb_cloned(skb)) {
-                               if (!realloc)
-                                       BUG();
+                               BUG_ON(!realloc);
                                if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
                                        return -ENOMEM;
                        }
@@ -894,8 +893,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
                struct sk_buff *insp = NULL;
 
                do {
-                       if (!list)
-                               BUG();
+                       BUG_ON(!list);
 
                        if (list->len <= eat) {
                                /* Eaten as whole. */
@@ -1199,8 +1197,7 @@ unsigned int skb_checksum(const struct sk_buff *skb, int offset,
                        start = end;
                }
        }
-       if (len)
-               BUG();
+       BUG_ON(len);
 
        return csum;
 }
@@ -1282,8 +1279,7 @@ unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
                        start = end;
                }
        }
-       if (len)
-               BUG();
+       BUG_ON(len);
        return csum;
 }
 
@@ -1297,8 +1293,7 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
        else
                csstart = skb_headlen(skb);
 
-       if (csstart > skb_headlen(skb))
-               BUG();
+       BUG_ON(csstart > skb_headlen(skb));
 
        memcpy(to, skb->data, csstart);
 
index be5a519cd2f8737c12659dbd2b76ee480a11eb68..105039eb7629359c92884305de6506235da2dc1b 100644 (file)
@@ -899,8 +899,7 @@ static void icmp_address_reply(struct sk_buff *skb)
                u32 _mask, *mp;
 
                mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask);
-               if (mp == NULL)
-                       BUG();
+               BUG_ON(mp == NULL);
                for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
                        if (*mp == ifa->ifa_mask &&
                            inet_ifa_match(rt->rt_src, ifa))
index ce5fe3f74a3d868cc68a3a395e7685c0608bbbd0..2160874ce7aa682db5edda0e8eacb4cce44c7e44 100644 (file)
@@ -304,8 +304,7 @@ static void unlink_from_pool(struct inet_peer *p)
                        /* look for a node to insert instead of p */
                        struct inet_peer *t;
                        t = lookup_rightempty(p);
-                       if (*stackptr[-1] != t)
-                               BUG();
+                       BUG_ON(*stackptr[-1] != t);
                        **--stackptr = t->avl_left;
                        /* t is removed, t->v4daddr > x->v4daddr for any
                         * x in p->avl_left subtree.
@@ -314,8 +313,7 @@ static void unlink_from_pool(struct inet_peer *p)
                        t->avl_left = p->avl_left;
                        t->avl_right = p->avl_right;
                        t->avl_height = p->avl_height;
-                       if (delp[1] != &p->avl_left)
-                               BUG();
+                       BUG_ON(delp[1] != &p->avl_left);
                        delp[1] = &t->avl_left; /* was &p->avl_left */
                }
                peer_avl_rebalance(stack, stackptr);
index 0a461232329fa328dcf20186054f87049ec3a7bc..a97ed5416c28ee14ecab0ac4483c079a0c3e4c1d 100644 (file)
@@ -3347,7 +3347,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list,
                        int offset = start - TCP_SKB_CB(skb)->seq;
                        int size = TCP_SKB_CB(skb)->end_seq - start;
 
-                       if (offset < 0) BUG();
+                       BUG_ON(offset < 0);
                        if (size > 0) {
                                size = min(copy, size);
                                if (skb_copy_bits(skb, offset, skb_put(nskb, size), size))
index 52efd04cbedbb64ea409e1d81f5d608d8e52caa4..4c2f6d694f883341f41fca5e718abc65d3d897a7 100644 (file)
@@ -297,8 +297,7 @@ static int pfkey_error(struct sadb_msg *orig, int err, struct sock *sk)
                err = EINTR;
        if (err >= 512)
                err = EINVAL;
-       if (err <= 0 || err >= 256)
-               BUG();
+       BUG_ON(err <= 0 || err >= 256);
 
        hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg));
        pfkey_hdr_dup(hdr, orig);
index 2d7d8a5db2ac5c8c69c793ce1f368e9fb5a756e7..b8b38aba92b3aa4496e5f2e668a1ba6bfe70c6ab 100644 (file)
@@ -1250,8 +1250,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
                case SCTP_CMD_TIMER_START:
                        timer = &asoc->timers[cmd->obj.to];
                        timeout = asoc->timeouts[cmd->obj.to];
-                       if (!timeout)
-                               BUG();
+                       BUG_ON(!timeout);
 
                        timer->expires = jiffies + timeout;
                        sctp_association_hold(asoc);
index f509e99927675e173f251f44637f976489a0abf1..dcaa0c4453ff4b0a7eb532a5676bfe3d27349e5c 100644 (file)
@@ -575,12 +575,11 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
        if (rp->q.list.next == &cd->queue) {
                spin_unlock(&queue_lock);
                up(&queue_io_sem);
-               if (rp->offset)
-                       BUG();
+               BUG_ON(rp->offset);
                return 0;
        }
        rq = container_of(rp->q.list.next, struct cache_request, q.list);
-       if (rq->q.reader) BUG();
+       BUG_ON(rq->q.reader);
        if (rp->offset == 0)
                rq->readers++;
        spin_unlock(&queue_lock);
index e4296c8b861eba85fead5bf1d839aa212e59ac7c..b19cc26fa9c24b9457c38d5bdabd37f2295e41c2 100644 (file)
@@ -122,8 +122,7 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size)
        rqstp->rq_argused = 0;
        rqstp->rq_resused = 0;
        arghi = 0;
-       if (pages > RPCSVC_MAXPAGES)
-               BUG();
+       BUG_ON(pages > RPCSVC_MAXPAGES);
        while (pages) {
                struct page *p = alloc_page(GFP_KERNEL);
                if (!p)
index 2f4531fcaca23d43e8b49702b84dd5288acedf1e..6ed3302312fb56f0ebb2784b9990df6dca740865 100644 (file)
@@ -540,8 +540,7 @@ void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm,
                        start = end;
                }
        }
-       if (len)
-               BUG();
+       BUG_ON(len);
 }
 EXPORT_SYMBOL_GPL(skb_icv_walk);
 
@@ -610,8 +609,7 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
                        start = end;
                }
        }
-       if (len)
-               BUG();
+       BUG_ON(len);
        return elt;
 }
 EXPORT_SYMBOL_GPL(skb_to_sgvec);
index 59614a994b4e51c7384200134e08bba86190e82d..077bbf9fb9b7605f08af1de583141bbea0429be0 100644 (file)
@@ -248,11 +248,9 @@ EXPORT_SYMBOL(xfrm_policy_alloc);
 
 void __xfrm_policy_destroy(struct xfrm_policy *policy)
 {
-       if (!policy->dead)
-               BUG();
+       BUG_ON(!policy->dead);
 
-       if (policy->bundles)
-               BUG();
+       BUG_ON(policy->bundles);
 
        if (del_timer(&policy->timer))
                BUG();