diff options
author | Kris Katterjohn <kjak@users.sourceforge.net> | 2006-01-09 01:24:28 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-09 17:16:18 -0500 |
commit | 09a626600b437d91f6b13ade5c7c4b374893c54e (patch) | |
tree | a6de3c2a33b7d896cd22a3fe799d1b40d28daf40 | |
parent | 4bba3925924148c24fb0c7636a04ad69a6a56b84 (diff) |
[NET]: Change some "if (x) BUG();" to "BUG_ON(x);"
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>
-rw-r--r-- | net/core/dev.c | 9 | ||||
-rw-r--r-- | net/core/skbuff.c | 15 | ||||
-rw-r--r-- | net/ipv4/icmp.c | 3 | ||||
-rw-r--r-- | net/ipv4/inetpeer.c | 6 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 2 | ||||
-rw-r--r-- | net/key/af_key.c | 3 | ||||
-rw-r--r-- | net/sctp/sm_sideeffect.c | 3 | ||||
-rw-r--r-- | net/sunrpc/cache.c | 5 | ||||
-rw-r--r-- | net/sunrpc/svc.c | 3 | ||||
-rw-r--r-- | net/xfrm/xfrm_algo.c | 6 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 6 |
11 files changed, 21 insertions, 40 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 5081287923d5..bf66b114d3c2 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1092,15 +1092,12 @@ int skb_checksum_help(struct sk_buff *skb, int inward) | |||
1092 | goto out; | 1092 | goto out; |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | if (offset > (int)skb->len) | 1095 | BUG_ON(offset > (int)skb->len); |
1096 | BUG(); | ||
1097 | csum = skb_checksum(skb, offset, skb->len-offset, 0); | 1096 | csum = skb_checksum(skb, offset, skb->len-offset, 0); |
1098 | 1097 | ||
1099 | offset = skb->tail - skb->h.raw; | 1098 | offset = skb->tail - skb->h.raw; |
1100 | if (offset <= 0) | 1099 | BUG_ON(offset <= 0); |
1101 | BUG(); | 1100 | BUG_ON(skb->csum + 2 > offset); |
1102 | if (skb->csum + 2 > offset) | ||
1103 | BUG(); | ||
1104 | 1101 | ||
1105 | *(u16*)(skb->h.raw + skb->csum) = csum_fold(csum); | 1102 | *(u16*)(skb->h.raw + skb->csum) = csum_fold(csum); |
1106 | skb->ip_summed = CHECKSUM_NONE; | 1103 | skb->ip_summed = CHECKSUM_NONE; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 070f91cfde59..d0732e9c8560 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -791,8 +791,7 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len, int realloc) | |||
791 | int end = offset + skb_shinfo(skb)->frags[i].size; | 791 | int end = offset + skb_shinfo(skb)->frags[i].size; |
792 | if (end > len) { | 792 | if (end > len) { |
793 | if (skb_cloned(skb)) { | 793 | if (skb_cloned(skb)) { |
794 | if (!realloc) | 794 | BUG_ON(!realloc); |
795 | BUG(); | ||
796 | if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) | 795 | if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) |
797 | return -ENOMEM; | 796 | return -ENOMEM; |
798 | } | 797 | } |
@@ -894,8 +893,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta) | |||
894 | struct sk_buff *insp = NULL; | 893 | struct sk_buff *insp = NULL; |
895 | 894 | ||
896 | do { | 895 | do { |
897 | if (!list) | 896 | BUG_ON(!list); |
898 | BUG(); | ||
899 | 897 | ||
900 | if (list->len <= eat) { | 898 | if (list->len <= eat) { |
901 | /* Eaten as whole. */ | 899 | /* Eaten as whole. */ |
@@ -1199,8 +1197,7 @@ unsigned int skb_checksum(const struct sk_buff *skb, int offset, | |||
1199 | start = end; | 1197 | start = end; |
1200 | } | 1198 | } |
1201 | } | 1199 | } |
1202 | if (len) | 1200 | BUG_ON(len); |
1203 | BUG(); | ||
1204 | 1201 | ||
1205 | return csum; | 1202 | return csum; |
1206 | } | 1203 | } |
@@ -1282,8 +1279,7 @@ unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, | |||
1282 | start = end; | 1279 | start = end; |
1283 | } | 1280 | } |
1284 | } | 1281 | } |
1285 | if (len) | 1282 | BUG_ON(len); |
1286 | BUG(); | ||
1287 | return csum; | 1283 | return csum; |
1288 | } | 1284 | } |
1289 | 1285 | ||
@@ -1297,8 +1293,7 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to) | |||
1297 | else | 1293 | else |
1298 | csstart = skb_headlen(skb); | 1294 | csstart = skb_headlen(skb); |
1299 | 1295 | ||
1300 | if (csstart > skb_headlen(skb)) | 1296 | BUG_ON(csstart > skb_headlen(skb)); |
1301 | BUG(); | ||
1302 | 1297 | ||
1303 | memcpy(to, skb->data, csstart); | 1298 | memcpy(to, skb->data, csstart); |
1304 | 1299 | ||
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index be5a519cd2f8..105039eb7629 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -899,8 +899,7 @@ static void icmp_address_reply(struct sk_buff *skb) | |||
899 | u32 _mask, *mp; | 899 | u32 _mask, *mp; |
900 | 900 | ||
901 | mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask); | 901 | mp = skb_header_pointer(skb, 0, sizeof(_mask), &_mask); |
902 | if (mp == NULL) | 902 | BUG_ON(mp == NULL); |
903 | BUG(); | ||
904 | for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { | 903 | for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { |
905 | if (*mp == ifa->ifa_mask && | 904 | if (*mp == ifa->ifa_mask && |
906 | inet_ifa_match(rt->rt_src, ifa)) | 905 | inet_ifa_match(rt->rt_src, ifa)) |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index ce5fe3f74a3d..2160874ce7aa 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -304,8 +304,7 @@ static void unlink_from_pool(struct inet_peer *p) | |||
304 | /* look for a node to insert instead of p */ | 304 | /* look for a node to insert instead of p */ |
305 | struct inet_peer *t; | 305 | struct inet_peer *t; |
306 | t = lookup_rightempty(p); | 306 | t = lookup_rightempty(p); |
307 | if (*stackptr[-1] != t) | 307 | BUG_ON(*stackptr[-1] != t); |
308 | BUG(); | ||
309 | **--stackptr = t->avl_left; | 308 | **--stackptr = t->avl_left; |
310 | /* t is removed, t->v4daddr > x->v4daddr for any | 309 | /* t is removed, t->v4daddr > x->v4daddr for any |
311 | * x in p->avl_left subtree. | 310 | * x in p->avl_left subtree. |
@@ -314,8 +313,7 @@ static void unlink_from_pool(struct inet_peer *p) | |||
314 | t->avl_left = p->avl_left; | 313 | t->avl_left = p->avl_left; |
315 | t->avl_right = p->avl_right; | 314 | t->avl_right = p->avl_right; |
316 | t->avl_height = p->avl_height; | 315 | t->avl_height = p->avl_height; |
317 | if (delp[1] != &p->avl_left) | 316 | BUG_ON(delp[1] != &p->avl_left); |
318 | BUG(); | ||
319 | delp[1] = &t->avl_left; /* was &p->avl_left */ | 317 | delp[1] = &t->avl_left; /* was &p->avl_left */ |
320 | } | 318 | } |
321 | peer_avl_rebalance(stack, stackptr); | 319 | peer_avl_rebalance(stack, stackptr); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 0a461232329f..a97ed5416c28 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -3347,7 +3347,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, | |||
3347 | int offset = start - TCP_SKB_CB(skb)->seq; | 3347 | int offset = start - TCP_SKB_CB(skb)->seq; |
3348 | int size = TCP_SKB_CB(skb)->end_seq - start; | 3348 | int size = TCP_SKB_CB(skb)->end_seq - start; |
3349 | 3349 | ||
3350 | if (offset < 0) BUG(); | 3350 | BUG_ON(offset < 0); |
3351 | if (size > 0) { | 3351 | if (size > 0) { |
3352 | size = min(copy, size); | 3352 | size = min(copy, size); |
3353 | if (skb_copy_bits(skb, offset, skb_put(nskb, size), size)) | 3353 | if (skb_copy_bits(skb, offset, skb_put(nskb, size), size)) |
diff --git a/net/key/af_key.c b/net/key/af_key.c index 52efd04cbedb..4c2f6d694f88 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -297,8 +297,7 @@ static int pfkey_error(struct sadb_msg *orig, int err, struct sock *sk) | |||
297 | err = EINTR; | 297 | err = EINTR; |
298 | if (err >= 512) | 298 | if (err >= 512) |
299 | err = EINVAL; | 299 | err = EINVAL; |
300 | if (err <= 0 || err >= 256) | 300 | BUG_ON(err <= 0 || err >= 256); |
301 | BUG(); | ||
302 | 301 | ||
303 | hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); | 302 | hdr = (struct sadb_msg *) skb_put(skb, sizeof(struct sadb_msg)); |
304 | pfkey_hdr_dup(hdr, orig); | 303 | pfkey_hdr_dup(hdr, orig); |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 2d7d8a5db2ac..b8b38aba92b3 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -1250,8 +1250,7 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, | |||
1250 | case SCTP_CMD_TIMER_START: | 1250 | case SCTP_CMD_TIMER_START: |
1251 | timer = &asoc->timers[cmd->obj.to]; | 1251 | timer = &asoc->timers[cmd->obj.to]; |
1252 | timeout = asoc->timeouts[cmd->obj.to]; | 1252 | timeout = asoc->timeouts[cmd->obj.to]; |
1253 | if (!timeout) | 1253 | BUG_ON(!timeout); |
1254 | BUG(); | ||
1255 | 1254 | ||
1256 | timer->expires = jiffies + timeout; | 1255 | timer->expires = jiffies + timeout; |
1257 | sctp_association_hold(asoc); | 1256 | sctp_association_hold(asoc); |
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index f509e9992767..dcaa0c4453ff 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -575,12 +575,11 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | |||
575 | if (rp->q.list.next == &cd->queue) { | 575 | if (rp->q.list.next == &cd->queue) { |
576 | spin_unlock(&queue_lock); | 576 | spin_unlock(&queue_lock); |
577 | up(&queue_io_sem); | 577 | up(&queue_io_sem); |
578 | if (rp->offset) | 578 | BUG_ON(rp->offset); |
579 | BUG(); | ||
580 | return 0; | 579 | return 0; |
581 | } | 580 | } |
582 | rq = container_of(rp->q.list.next, struct cache_request, q.list); | 581 | rq = container_of(rp->q.list.next, struct cache_request, q.list); |
583 | if (rq->q.reader) BUG(); | 582 | BUG_ON(rq->q.reader); |
584 | if (rp->offset == 0) | 583 | if (rp->offset == 0) |
585 | rq->readers++; | 584 | rq->readers++; |
586 | spin_unlock(&queue_lock); | 585 | spin_unlock(&queue_lock); |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index e4296c8b861e..b19cc26fa9c2 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -122,8 +122,7 @@ svc_init_buffer(struct svc_rqst *rqstp, unsigned int size) | |||
122 | rqstp->rq_argused = 0; | 122 | rqstp->rq_argused = 0; |
123 | rqstp->rq_resused = 0; | 123 | rqstp->rq_resused = 0; |
124 | arghi = 0; | 124 | arghi = 0; |
125 | if (pages > RPCSVC_MAXPAGES) | 125 | BUG_ON(pages > RPCSVC_MAXPAGES); |
126 | BUG(); | ||
127 | while (pages) { | 126 | while (pages) { |
128 | struct page *p = alloc_page(GFP_KERNEL); | 127 | struct page *p = alloc_page(GFP_KERNEL); |
129 | if (!p) | 128 | if (!p) |
diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c index 2f4531fcaca2..6ed3302312fb 100644 --- a/net/xfrm/xfrm_algo.c +++ b/net/xfrm/xfrm_algo.c | |||
@@ -540,8 +540,7 @@ void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm, | |||
540 | start = end; | 540 | start = end; |
541 | } | 541 | } |
542 | } | 542 | } |
543 | if (len) | 543 | BUG_ON(len); |
544 | BUG(); | ||
545 | } | 544 | } |
546 | EXPORT_SYMBOL_GPL(skb_icv_walk); | 545 | EXPORT_SYMBOL_GPL(skb_icv_walk); |
547 | 546 | ||
@@ -610,8 +609,7 @@ skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len) | |||
610 | start = end; | 609 | start = end; |
611 | } | 610 | } |
612 | } | 611 | } |
613 | if (len) | 612 | BUG_ON(len); |
614 | BUG(); | ||
615 | return elt; | 613 | return elt; |
616 | } | 614 | } |
617 | EXPORT_SYMBOL_GPL(skb_to_sgvec); | 615 | EXPORT_SYMBOL_GPL(skb_to_sgvec); |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 59614a994b4e..077bbf9fb9b7 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -248,11 +248,9 @@ EXPORT_SYMBOL(xfrm_policy_alloc); | |||
248 | 248 | ||
249 | void __xfrm_policy_destroy(struct xfrm_policy *policy) | 249 | void __xfrm_policy_destroy(struct xfrm_policy *policy) |
250 | { | 250 | { |
251 | if (!policy->dead) | 251 | BUG_ON(!policy->dead); |
252 | BUG(); | ||
253 | 252 | ||
254 | if (policy->bundles) | 253 | BUG_ON(policy->bundles); |
255 | BUG(); | ||
256 | 254 | ||
257 | if (del_timer(&policy->timer)) | 255 | if (del_timer(&policy->timer)) |
258 | BUG(); | 256 | BUG(); |