diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2008-07-26 00:43:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-26 00:43:18 -0400 |
commit | 547b792cac0a038b9dbf958d3c120df3740b5572 (patch) | |
tree | 08554d083b0ca7d65739dc1ce12f9b12a9b8e1f8 /net/ipv6 | |
parent | 53e5e96ec18da6f65e89f05674711e1c93d8df67 (diff) |
net: convert BUG_TRAP to generic WARN_ON
Removes legacy reinvent-the-wheel type thing. The generic
machinery integrates much better to automated debugging aids
such as kerneloops.org (and others), and is unambiguous due to
better naming. Non-intuively BUG_TRAP() is actually equal to
WARN_ON() rather than BUG_ON() though some might actually be
promoted to BUG_ON() but I left that to future.
I could make at least one BUILD_BUG_ON conversion.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 11 | ||||
-rw-r--r-- | net/ipv6/af_inet6.c | 2 | ||||
-rw-r--r-- | net/ipv6/inet6_connection_sock.c | 2 | ||||
-rw-r--r-- | net/ipv6/inet6_hashtables.c | 4 | ||||
-rw-r--r-- | net/ipv6/ip6_fib.c | 31 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 2 | ||||
-rw-r--r-- | net/ipv6/mip6.c | 8 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_reasm.c | 4 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 4 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 2 |
10 files changed, 37 insertions, 33 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 74d543d504a1..a7842c54f58a 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -313,8 +313,10 @@ static void in6_dev_finish_destroy_rcu(struct rcu_head *head) | |||
313 | void in6_dev_finish_destroy(struct inet6_dev *idev) | 313 | void in6_dev_finish_destroy(struct inet6_dev *idev) |
314 | { | 314 | { |
315 | struct net_device *dev = idev->dev; | 315 | struct net_device *dev = idev->dev; |
316 | BUG_TRAP(idev->addr_list==NULL); | 316 | |
317 | BUG_TRAP(idev->mc_list==NULL); | 317 | WARN_ON(idev->addr_list != NULL); |
318 | WARN_ON(idev->mc_list != NULL); | ||
319 | |||
318 | #ifdef NET_REFCNT_DEBUG | 320 | #ifdef NET_REFCNT_DEBUG |
319 | printk(KERN_DEBUG "in6_dev_finish_destroy: %s\n", dev ? dev->name : "NIL"); | 321 | printk(KERN_DEBUG "in6_dev_finish_destroy: %s\n", dev ? dev->name : "NIL"); |
320 | #endif | 322 | #endif |
@@ -517,8 +519,9 @@ static void addrconf_fixup_forwarding(struct ctl_table *table, int *p, int old) | |||
517 | 519 | ||
518 | void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp) | 520 | void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp) |
519 | { | 521 | { |
520 | BUG_TRAP(ifp->if_next==NULL); | 522 | WARN_ON(ifp->if_next != NULL); |
521 | BUG_TRAP(ifp->lst_next==NULL); | 523 | WARN_ON(ifp->lst_next != NULL); |
524 | |||
522 | #ifdef NET_REFCNT_DEBUG | 525 | #ifdef NET_REFCNT_DEBUG |
523 | printk(KERN_DEBUG "inet6_ifa_finish_destroy\n"); | 526 | printk(KERN_DEBUG "inet6_ifa_finish_destroy\n"); |
524 | #endif | 527 | #endif |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 3d828bc4b1cf..0843c4d6218c 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -153,7 +153,7 @@ lookup_protocol: | |||
153 | answer_flags = answer->flags; | 153 | answer_flags = answer->flags; |
154 | rcu_read_unlock(); | 154 | rcu_read_unlock(); |
155 | 155 | ||
156 | BUG_TRAP(answer_prot->slab != NULL); | 156 | WARN_ON(answer_prot->slab == NULL); |
157 | 157 | ||
158 | err = -ENOBUFS; | 158 | err = -ENOBUFS; |
159 | sk = sk_alloc(net, PF_INET6, GFP_KERNEL, answer_prot); | 159 | sk = sk_alloc(net, PF_INET6, GFP_KERNEL, answer_prot); |
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 87801cc1b2f8..16d43f20b32f 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -98,7 +98,7 @@ struct request_sock *inet6_csk_search_req(const struct sock *sk, | |||
98 | ipv6_addr_equal(&treq->rmt_addr, raddr) && | 98 | ipv6_addr_equal(&treq->rmt_addr, raddr) && |
99 | ipv6_addr_equal(&treq->loc_addr, laddr) && | 99 | ipv6_addr_equal(&treq->loc_addr, laddr) && |
100 | (!treq->iif || treq->iif == iif)) { | 100 | (!treq->iif || treq->iif == iif)) { |
101 | BUG_TRAP(req->sk == NULL); | 101 | WARN_ON(req->sk != NULL); |
102 | *prevp = prev; | 102 | *prevp = prev; |
103 | return req; | 103 | return req; |
104 | } | 104 | } |
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index 00a8a5f9380c..1646a5658255 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
@@ -28,7 +28,7 @@ void __inet6_hash(struct sock *sk) | |||
28 | struct hlist_head *list; | 28 | struct hlist_head *list; |
29 | rwlock_t *lock; | 29 | rwlock_t *lock; |
30 | 30 | ||
31 | BUG_TRAP(sk_unhashed(sk)); | 31 | WARN_ON(!sk_unhashed(sk)); |
32 | 32 | ||
33 | if (sk->sk_state == TCP_LISTEN) { | 33 | if (sk->sk_state == TCP_LISTEN) { |
34 | list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; | 34 | list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; |
@@ -202,7 +202,7 @@ unique: | |||
202 | * in hash table socket with a funny identity. */ | 202 | * in hash table socket with a funny identity. */ |
203 | inet->num = lport; | 203 | inet->num = lport; |
204 | inet->sport = htons(lport); | 204 | inet->sport = htons(lport); |
205 | BUG_TRAP(sk_unhashed(sk)); | 205 | WARN_ON(!sk_unhashed(sk)); |
206 | __sk_add_node(sk, &head->chain); | 206 | __sk_add_node(sk, &head->chain); |
207 | sk->sk_hash = hash; | 207 | sk->sk_hash = hash; |
208 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); | 208 | sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 08ea2de28d63..52dddc25d3e6 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -287,7 +287,7 @@ static int fib6_dump_node(struct fib6_walker_t *w) | |||
287 | w->leaf = rt; | 287 | w->leaf = rt; |
288 | return 1; | 288 | return 1; |
289 | } | 289 | } |
290 | BUG_TRAP(res!=0); | 290 | WARN_ON(res == 0); |
291 | } | 291 | } |
292 | w->leaf = NULL; | 292 | w->leaf = NULL; |
293 | return 0; | 293 | return 0; |
@@ -778,7 +778,7 @@ out: | |||
778 | pn->leaf = fib6_find_prefix(info->nl_net, pn); | 778 | pn->leaf = fib6_find_prefix(info->nl_net, pn); |
779 | #if RT6_DEBUG >= 2 | 779 | #if RT6_DEBUG >= 2 |
780 | if (!pn->leaf) { | 780 | if (!pn->leaf) { |
781 | BUG_TRAP(pn->leaf != NULL); | 781 | WARN_ON(pn->leaf == NULL); |
782 | pn->leaf = info->nl_net->ipv6.ip6_null_entry; | 782 | pn->leaf = info->nl_net->ipv6.ip6_null_entry; |
783 | } | 783 | } |
784 | #endif | 784 | #endif |
@@ -942,7 +942,7 @@ struct fib6_node * fib6_locate(struct fib6_node *root, | |||
942 | 942 | ||
943 | #ifdef CONFIG_IPV6_SUBTREES | 943 | #ifdef CONFIG_IPV6_SUBTREES |
944 | if (src_len) { | 944 | if (src_len) { |
945 | BUG_TRAP(saddr!=NULL); | 945 | WARN_ON(saddr == NULL); |
946 | if (fn && fn->subtree) | 946 | if (fn && fn->subtree) |
947 | fn = fib6_locate_1(fn->subtree, saddr, src_len, | 947 | fn = fib6_locate_1(fn->subtree, saddr, src_len, |
948 | offsetof(struct rt6_info, rt6i_src)); | 948 | offsetof(struct rt6_info, rt6i_src)); |
@@ -996,9 +996,9 @@ static struct fib6_node *fib6_repair_tree(struct net *net, | |||
996 | RT6_TRACE("fixing tree: plen=%d iter=%d\n", fn->fn_bit, iter); | 996 | RT6_TRACE("fixing tree: plen=%d iter=%d\n", fn->fn_bit, iter); |
997 | iter++; | 997 | iter++; |
998 | 998 | ||
999 | BUG_TRAP(!(fn->fn_flags&RTN_RTINFO)); | 999 | WARN_ON(fn->fn_flags & RTN_RTINFO); |
1000 | BUG_TRAP(!(fn->fn_flags&RTN_TL_ROOT)); | 1000 | WARN_ON(fn->fn_flags & RTN_TL_ROOT); |
1001 | BUG_TRAP(fn->leaf==NULL); | 1001 | WARN_ON(fn->leaf != NULL); |
1002 | 1002 | ||
1003 | children = 0; | 1003 | children = 0; |
1004 | child = NULL; | 1004 | child = NULL; |
@@ -1014,7 +1014,7 @@ static struct fib6_node *fib6_repair_tree(struct net *net, | |||
1014 | fn->leaf = fib6_find_prefix(net, fn); | 1014 | fn->leaf = fib6_find_prefix(net, fn); |
1015 | #if RT6_DEBUG >= 2 | 1015 | #if RT6_DEBUG >= 2 |
1016 | if (fn->leaf==NULL) { | 1016 | if (fn->leaf==NULL) { |
1017 | BUG_TRAP(fn->leaf); | 1017 | WARN_ON(!fn->leaf); |
1018 | fn->leaf = net->ipv6.ip6_null_entry; | 1018 | fn->leaf = net->ipv6.ip6_null_entry; |
1019 | } | 1019 | } |
1020 | #endif | 1020 | #endif |
@@ -1025,16 +1025,17 @@ static struct fib6_node *fib6_repair_tree(struct net *net, | |||
1025 | pn = fn->parent; | 1025 | pn = fn->parent; |
1026 | #ifdef CONFIG_IPV6_SUBTREES | 1026 | #ifdef CONFIG_IPV6_SUBTREES |
1027 | if (FIB6_SUBTREE(pn) == fn) { | 1027 | if (FIB6_SUBTREE(pn) == fn) { |
1028 | BUG_TRAP(fn->fn_flags&RTN_ROOT); | 1028 | WARN_ON(!(fn->fn_flags & RTN_ROOT)); |
1029 | FIB6_SUBTREE(pn) = NULL; | 1029 | FIB6_SUBTREE(pn) = NULL; |
1030 | nstate = FWS_L; | 1030 | nstate = FWS_L; |
1031 | } else { | 1031 | } else { |
1032 | BUG_TRAP(!(fn->fn_flags&RTN_ROOT)); | 1032 | WARN_ON(fn->fn_flags & RTN_ROOT); |
1033 | #endif | 1033 | #endif |
1034 | if (pn->right == fn) pn->right = child; | 1034 | if (pn->right == fn) pn->right = child; |
1035 | else if (pn->left == fn) pn->left = child; | 1035 | else if (pn->left == fn) pn->left = child; |
1036 | #if RT6_DEBUG >= 2 | 1036 | #if RT6_DEBUG >= 2 |
1037 | else BUG_TRAP(0); | 1037 | else |
1038 | WARN_ON(1); | ||
1038 | #endif | 1039 | #endif |
1039 | if (child) | 1040 | if (child) |
1040 | child->parent = pn; | 1041 | child->parent = pn; |
@@ -1154,14 +1155,14 @@ int fib6_del(struct rt6_info *rt, struct nl_info *info) | |||
1154 | 1155 | ||
1155 | #if RT6_DEBUG >= 2 | 1156 | #if RT6_DEBUG >= 2 |
1156 | if (rt->u.dst.obsolete>0) { | 1157 | if (rt->u.dst.obsolete>0) { |
1157 | BUG_TRAP(fn==NULL); | 1158 | WARN_ON(fn != NULL); |
1158 | return -ENOENT; | 1159 | return -ENOENT; |
1159 | } | 1160 | } |
1160 | #endif | 1161 | #endif |
1161 | if (fn == NULL || rt == net->ipv6.ip6_null_entry) | 1162 | if (fn == NULL || rt == net->ipv6.ip6_null_entry) |
1162 | return -ENOENT; | 1163 | return -ENOENT; |
1163 | 1164 | ||
1164 | BUG_TRAP(fn->fn_flags&RTN_RTINFO); | 1165 | WARN_ON(!(fn->fn_flags & RTN_RTINFO)); |
1165 | 1166 | ||
1166 | if (!(rt->rt6i_flags&RTF_CACHE)) { | 1167 | if (!(rt->rt6i_flags&RTF_CACHE)) { |
1167 | struct fib6_node *pn = fn; | 1168 | struct fib6_node *pn = fn; |
@@ -1266,7 +1267,7 @@ static int fib6_walk_continue(struct fib6_walker_t *w) | |||
1266 | w->node = pn; | 1267 | w->node = pn; |
1267 | #ifdef CONFIG_IPV6_SUBTREES | 1268 | #ifdef CONFIG_IPV6_SUBTREES |
1268 | if (FIB6_SUBTREE(pn) == fn) { | 1269 | if (FIB6_SUBTREE(pn) == fn) { |
1269 | BUG_TRAP(fn->fn_flags&RTN_ROOT); | 1270 | WARN_ON(!(fn->fn_flags & RTN_ROOT)); |
1270 | w->state = FWS_L; | 1271 | w->state = FWS_L; |
1271 | continue; | 1272 | continue; |
1272 | } | 1273 | } |
@@ -1281,7 +1282,7 @@ static int fib6_walk_continue(struct fib6_walker_t *w) | |||
1281 | continue; | 1282 | continue; |
1282 | } | 1283 | } |
1283 | #if RT6_DEBUG >= 2 | 1284 | #if RT6_DEBUG >= 2 |
1284 | BUG_TRAP(0); | 1285 | WARN_ON(1); |
1285 | #endif | 1286 | #endif |
1286 | } | 1287 | } |
1287 | } | 1288 | } |
@@ -1323,7 +1324,7 @@ static int fib6_clean_node(struct fib6_walker_t *w) | |||
1323 | } | 1324 | } |
1324 | return 0; | 1325 | return 0; |
1325 | } | 1326 | } |
1326 | BUG_TRAP(res==0); | 1327 | WARN_ON(res != 0); |
1327 | } | 1328 | } |
1328 | w->leaf = rt; | 1329 | w->leaf = rt; |
1329 | return 0; | 1330 | return 0; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 6407c64ea4a5..6811901e6b1e 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -116,7 +116,7 @@ static int ip6_dev_loopback_xmit(struct sk_buff *newskb) | |||
116 | __skb_pull(newskb, skb_network_offset(newskb)); | 116 | __skb_pull(newskb, skb_network_offset(newskb)); |
117 | newskb->pkt_type = PACKET_LOOPBACK; | 117 | newskb->pkt_type = PACKET_LOOPBACK; |
118 | newskb->ip_summed = CHECKSUM_UNNECESSARY; | 118 | newskb->ip_summed = CHECKSUM_UNNECESSARY; |
119 | BUG_TRAP(newskb->dst); | 119 | WARN_ON(!newskb->dst); |
120 | 120 | ||
121 | netif_rx(newskb); | 121 | netif_rx(newskb); |
122 | return 0; | 122 | return 0; |
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c index ad1cc5bbf977..31295c8f6196 100644 --- a/net/ipv6/mip6.c +++ b/net/ipv6/mip6.c | |||
@@ -164,8 +164,8 @@ static int mip6_destopt_output(struct xfrm_state *x, struct sk_buff *skb) | |||
164 | calc_padlen(sizeof(*dstopt), 6)); | 164 | calc_padlen(sizeof(*dstopt), 6)); |
165 | 165 | ||
166 | hao->type = IPV6_TLV_HAO; | 166 | hao->type = IPV6_TLV_HAO; |
167 | BUILD_BUG_ON(sizeof(*hao) != 18); | ||
167 | hao->length = sizeof(*hao) - 2; | 168 | hao->length = sizeof(*hao) - 2; |
168 | BUG_TRAP(hao->length == 16); | ||
169 | 169 | ||
170 | len = ((char *)hao - (char *)dstopt) + sizeof(*hao); | 170 | len = ((char *)hao - (char *)dstopt) + sizeof(*hao); |
171 | 171 | ||
@@ -174,7 +174,7 @@ static int mip6_destopt_output(struct xfrm_state *x, struct sk_buff *skb) | |||
174 | memcpy(&iph->saddr, x->coaddr, sizeof(iph->saddr)); | 174 | memcpy(&iph->saddr, x->coaddr, sizeof(iph->saddr)); |
175 | spin_unlock_bh(&x->lock); | 175 | spin_unlock_bh(&x->lock); |
176 | 176 | ||
177 | BUG_TRAP(len == x->props.header_len); | 177 | WARN_ON(len != x->props.header_len); |
178 | dstopt->hdrlen = (x->props.header_len >> 3) - 1; | 178 | dstopt->hdrlen = (x->props.header_len >> 3) - 1; |
179 | 179 | ||
180 | return 0; | 180 | return 0; |
@@ -317,7 +317,7 @@ static int mip6_destopt_init_state(struct xfrm_state *x) | |||
317 | x->props.header_len = sizeof(struct ipv6_destopt_hdr) + | 317 | x->props.header_len = sizeof(struct ipv6_destopt_hdr) + |
318 | calc_padlen(sizeof(struct ipv6_destopt_hdr), 6) + | 318 | calc_padlen(sizeof(struct ipv6_destopt_hdr), 6) + |
319 | sizeof(struct ipv6_destopt_hao); | 319 | sizeof(struct ipv6_destopt_hao); |
320 | BUG_TRAP(x->props.header_len == 24); | 320 | WARN_ON(x->props.header_len != 24); |
321 | 321 | ||
322 | return 0; | 322 | return 0; |
323 | } | 323 | } |
@@ -380,7 +380,7 @@ static int mip6_rthdr_output(struct xfrm_state *x, struct sk_buff *skb) | |||
380 | rt2->rt_hdr.segments_left = 1; | 380 | rt2->rt_hdr.segments_left = 1; |
381 | memset(&rt2->reserved, 0, sizeof(rt2->reserved)); | 381 | memset(&rt2->reserved, 0, sizeof(rt2->reserved)); |
382 | 382 | ||
383 | BUG_TRAP(rt2->rt_hdr.hdrlen == 2); | 383 | WARN_ON(rt2->rt_hdr.hdrlen != 2); |
384 | 384 | ||
385 | memcpy(&rt2->addr, &iph->daddr, sizeof(rt2->addr)); | 385 | memcpy(&rt2->addr, &iph->daddr, sizeof(rt2->addr)); |
386 | spin_lock_bh(&x->lock); | 386 | spin_lock_bh(&x->lock); |
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index cf20bc4fd60d..52d06dd4b817 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -416,8 +416,8 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev) | |||
416 | 416 | ||
417 | fq_kill(fq); | 417 | fq_kill(fq); |
418 | 418 | ||
419 | BUG_TRAP(head != NULL); | 419 | WARN_ON(head == NULL); |
420 | BUG_TRAP(NFCT_FRAG6_CB(head)->offset == 0); | 420 | WARN_ON(NFCT_FRAG6_CB(head)->offset != 0); |
421 | 421 | ||
422 | /* Unfragmented part is taken from the first segment. */ | 422 | /* Unfragmented part is taken from the first segment. */ |
423 | payload_len = ((head->data - skb_network_header(head)) - | 423 | payload_len = ((head->data - skb_network_header(head)) - |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 6ab957ec2dd6..89184b576e23 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -473,8 +473,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev, | |||
473 | fq->q.fragments = head; | 473 | fq->q.fragments = head; |
474 | } | 474 | } |
475 | 475 | ||
476 | BUG_TRAP(head != NULL); | 476 | WARN_ON(head == NULL); |
477 | BUG_TRAP(FRAG6_CB(head)->offset == 0); | 477 | WARN_ON(FRAG6_CB(head)->offset != 0); |
478 | 478 | ||
479 | /* Unfragmented part is taken from the first segment. */ | 479 | /* Unfragmented part is taken from the first segment. */ |
480 | payload_len = ((head->data - skb_network_header(head)) - | 480 | payload_len = ((head->data - skb_network_header(head)) - |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index ae45f9835014..cff778b23a7f 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -421,7 +421,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
421 | /* ICMPs are not backlogged, hence we cannot get | 421 | /* ICMPs are not backlogged, hence we cannot get |
422 | * an established socket here. | 422 | * an established socket here. |
423 | */ | 423 | */ |
424 | BUG_TRAP(req->sk == NULL); | 424 | WARN_ON(req->sk != NULL); |
425 | 425 | ||
426 | if (seq != tcp_rsk(req)->snt_isn) { | 426 | if (seq != tcp_rsk(req)->snt_isn) { |
427 | NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); | 427 | NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); |