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/core | |
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/core')
-rw-r--r-- | net/core/datagram.c | 8 | ||||
-rw-r--r-- | net/core/dev.c | 10 | ||||
-rw-r--r-- | net/core/request_sock.c | 2 | ||||
-rw-r--r-- | net/core/skbuff.c | 20 | ||||
-rw-r--r-- | net/core/stream.c | 6 | ||||
-rw-r--r-- | net/core/user_dma.c | 5 |
6 files changed, 25 insertions, 26 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c index 8a28fc93b724..dd61dcad6019 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -285,7 +285,7 @@ int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset, | |||
285 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 285 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
286 | int end; | 286 | int end; |
287 | 287 | ||
288 | BUG_TRAP(start <= offset + len); | 288 | WARN_ON(start > offset + len); |
289 | 289 | ||
290 | end = start + skb_shinfo(skb)->frags[i].size; | 290 | end = start + skb_shinfo(skb)->frags[i].size; |
291 | if ((copy = end - offset) > 0) { | 291 | if ((copy = end - offset) > 0) { |
@@ -315,7 +315,7 @@ int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset, | |||
315 | for (; list; list = list->next) { | 315 | for (; list; list = list->next) { |
316 | int end; | 316 | int end; |
317 | 317 | ||
318 | BUG_TRAP(start <= offset + len); | 318 | WARN_ON(start > offset + len); |
319 | 319 | ||
320 | end = start + list->len; | 320 | end = start + list->len; |
321 | if ((copy = end - offset) > 0) { | 321 | if ((copy = end - offset) > 0) { |
@@ -366,7 +366,7 @@ static int skb_copy_and_csum_datagram(const struct sk_buff *skb, int offset, | |||
366 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 366 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
367 | int end; | 367 | int end; |
368 | 368 | ||
369 | BUG_TRAP(start <= offset + len); | 369 | WARN_ON(start > offset + len); |
370 | 370 | ||
371 | end = start + skb_shinfo(skb)->frags[i].size; | 371 | end = start + skb_shinfo(skb)->frags[i].size; |
372 | if ((copy = end - offset) > 0) { | 372 | if ((copy = end - offset) > 0) { |
@@ -402,7 +402,7 @@ static int skb_copy_and_csum_datagram(const struct sk_buff *skb, int offset, | |||
402 | for (; list; list=list->next) { | 402 | for (; list; list=list->next) { |
403 | int end; | 403 | int end; |
404 | 404 | ||
405 | BUG_TRAP(start <= offset + len); | 405 | WARN_ON(start > offset + len); |
406 | 406 | ||
407 | end = start + list->len; | 407 | end = start + list->len; |
408 | if ((copy = end - offset) > 0) { | 408 | if ((copy = end - offset) > 0) { |
diff --git a/net/core/dev.c b/net/core/dev.c index ccf97f9f37eb..c6f9c83745e6 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1973,7 +1973,7 @@ static void net_tx_action(struct softirq_action *h) | |||
1973 | struct sk_buff *skb = clist; | 1973 | struct sk_buff *skb = clist; |
1974 | clist = clist->next; | 1974 | clist = clist->next; |
1975 | 1975 | ||
1976 | BUG_TRAP(!atomic_read(&skb->users)); | 1976 | WARN_ON(atomic_read(&skb->users)); |
1977 | __kfree_skb(skb); | 1977 | __kfree_skb(skb); |
1978 | } | 1978 | } |
1979 | } | 1979 | } |
@@ -3847,7 +3847,7 @@ static void rollback_registered(struct net_device *dev) | |||
3847 | dev->uninit(dev); | 3847 | dev->uninit(dev); |
3848 | 3848 | ||
3849 | /* Notifier chain MUST detach us from master device. */ | 3849 | /* Notifier chain MUST detach us from master device. */ |
3850 | BUG_TRAP(!dev->master); | 3850 | WARN_ON(dev->master); |
3851 | 3851 | ||
3852 | /* Remove entries from kobject tree */ | 3852 | /* Remove entries from kobject tree */ |
3853 | netdev_unregister_kobject(dev); | 3853 | netdev_unregister_kobject(dev); |
@@ -4169,9 +4169,9 @@ void netdev_run_todo(void) | |||
4169 | 4169 | ||
4170 | /* paranoia */ | 4170 | /* paranoia */ |
4171 | BUG_ON(atomic_read(&dev->refcnt)); | 4171 | BUG_ON(atomic_read(&dev->refcnt)); |
4172 | BUG_TRAP(!dev->ip_ptr); | 4172 | WARN_ON(dev->ip_ptr); |
4173 | BUG_TRAP(!dev->ip6_ptr); | 4173 | WARN_ON(dev->ip6_ptr); |
4174 | BUG_TRAP(!dev->dn_ptr); | 4174 | WARN_ON(dev->dn_ptr); |
4175 | 4175 | ||
4176 | if (dev->destructor) | 4176 | if (dev->destructor) |
4177 | dev->destructor(dev); | 4177 | dev->destructor(dev); |
diff --git a/net/core/request_sock.c b/net/core/request_sock.c index 2d3035d3abd7..7552495aff7a 100644 --- a/net/core/request_sock.c +++ b/net/core/request_sock.c | |||
@@ -123,7 +123,7 @@ void reqsk_queue_destroy(struct request_sock_queue *queue) | |||
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | BUG_TRAP(lopt->qlen == 0); | 126 | WARN_ON(lopt->qlen != 0); |
127 | if (lopt_size > PAGE_SIZE) | 127 | if (lopt_size > PAGE_SIZE) |
128 | vfree(lopt); | 128 | vfree(lopt); |
129 | else | 129 | else |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index e4115672b6cf..4e0c92274189 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1200,7 +1200,7 @@ int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len) | |||
1200 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 1200 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
1201 | int end; | 1201 | int end; |
1202 | 1202 | ||
1203 | BUG_TRAP(start <= offset + len); | 1203 | WARN_ON(start > offset + len); |
1204 | 1204 | ||
1205 | end = start + skb_shinfo(skb)->frags[i].size; | 1205 | end = start + skb_shinfo(skb)->frags[i].size; |
1206 | if ((copy = end - offset) > 0) { | 1206 | if ((copy = end - offset) > 0) { |
@@ -1229,7 +1229,7 @@ int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len) | |||
1229 | for (; list; list = list->next) { | 1229 | for (; list; list = list->next) { |
1230 | int end; | 1230 | int end; |
1231 | 1231 | ||
1232 | BUG_TRAP(start <= offset + len); | 1232 | WARN_ON(start > offset + len); |
1233 | 1233 | ||
1234 | end = start + list->len; | 1234 | end = start + list->len; |
1235 | if ((copy = end - offset) > 0) { | 1235 | if ((copy = end - offset) > 0) { |
@@ -1475,7 +1475,7 @@ int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len) | |||
1475 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 1475 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
1476 | int end; | 1476 | int end; |
1477 | 1477 | ||
1478 | BUG_TRAP(start <= offset + len); | 1478 | WARN_ON(start > offset + len); |
1479 | 1479 | ||
1480 | end = start + frag->size; | 1480 | end = start + frag->size; |
1481 | if ((copy = end - offset) > 0) { | 1481 | if ((copy = end - offset) > 0) { |
@@ -1503,7 +1503,7 @@ int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len) | |||
1503 | for (; list; list = list->next) { | 1503 | for (; list; list = list->next) { |
1504 | int end; | 1504 | int end; |
1505 | 1505 | ||
1506 | BUG_TRAP(start <= offset + len); | 1506 | WARN_ON(start > offset + len); |
1507 | 1507 | ||
1508 | end = start + list->len; | 1508 | end = start + list->len; |
1509 | if ((copy = end - offset) > 0) { | 1509 | if ((copy = end - offset) > 0) { |
@@ -1552,7 +1552,7 @@ __wsum skb_checksum(const struct sk_buff *skb, int offset, | |||
1552 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 1552 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
1553 | int end; | 1553 | int end; |
1554 | 1554 | ||
1555 | BUG_TRAP(start <= offset + len); | 1555 | WARN_ON(start > offset + len); |
1556 | 1556 | ||
1557 | end = start + skb_shinfo(skb)->frags[i].size; | 1557 | end = start + skb_shinfo(skb)->frags[i].size; |
1558 | if ((copy = end - offset) > 0) { | 1558 | if ((copy = end - offset) > 0) { |
@@ -1581,7 +1581,7 @@ __wsum skb_checksum(const struct sk_buff *skb, int offset, | |||
1581 | for (; list; list = list->next) { | 1581 | for (; list; list = list->next) { |
1582 | int end; | 1582 | int end; |
1583 | 1583 | ||
1584 | BUG_TRAP(start <= offset + len); | 1584 | WARN_ON(start > offset + len); |
1585 | 1585 | ||
1586 | end = start + list->len; | 1586 | end = start + list->len; |
1587 | if ((copy = end - offset) > 0) { | 1587 | if ((copy = end - offset) > 0) { |
@@ -1629,7 +1629,7 @@ __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, | |||
1629 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 1629 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
1630 | int end; | 1630 | int end; |
1631 | 1631 | ||
1632 | BUG_TRAP(start <= offset + len); | 1632 | WARN_ON(start > offset + len); |
1633 | 1633 | ||
1634 | end = start + skb_shinfo(skb)->frags[i].size; | 1634 | end = start + skb_shinfo(skb)->frags[i].size; |
1635 | if ((copy = end - offset) > 0) { | 1635 | if ((copy = end - offset) > 0) { |
@@ -1662,7 +1662,7 @@ __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, | |||
1662 | __wsum csum2; | 1662 | __wsum csum2; |
1663 | int end; | 1663 | int end; |
1664 | 1664 | ||
1665 | BUG_TRAP(start <= offset + len); | 1665 | WARN_ON(start > offset + len); |
1666 | 1666 | ||
1667 | end = start + list->len; | 1667 | end = start + list->len; |
1668 | if ((copy = end - offset) > 0) { | 1668 | if ((copy = end - offset) > 0) { |
@@ -2373,7 +2373,7 @@ __skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len) | |||
2373 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 2373 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
2374 | int end; | 2374 | int end; |
2375 | 2375 | ||
2376 | BUG_TRAP(start <= offset + len); | 2376 | WARN_ON(start > offset + len); |
2377 | 2377 | ||
2378 | end = start + skb_shinfo(skb)->frags[i].size; | 2378 | end = start + skb_shinfo(skb)->frags[i].size; |
2379 | if ((copy = end - offset) > 0) { | 2379 | if ((copy = end - offset) > 0) { |
@@ -2397,7 +2397,7 @@ __skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len) | |||
2397 | for (; list; list = list->next) { | 2397 | for (; list; list = list->next) { |
2398 | int end; | 2398 | int end; |
2399 | 2399 | ||
2400 | BUG_TRAP(start <= offset + len); | 2400 | WARN_ON(start > offset + len); |
2401 | 2401 | ||
2402 | end = start + list->len; | 2402 | end = start + list->len; |
2403 | if ((copy = end - offset) > 0) { | 2403 | if ((copy = end - offset) > 0) { |
diff --git a/net/core/stream.c b/net/core/stream.c index 4a0ad152c9c4..a6b3437ff082 100644 --- a/net/core/stream.c +++ b/net/core/stream.c | |||
@@ -192,13 +192,13 @@ void sk_stream_kill_queues(struct sock *sk) | |||
192 | __skb_queue_purge(&sk->sk_error_queue); | 192 | __skb_queue_purge(&sk->sk_error_queue); |
193 | 193 | ||
194 | /* Next, the write queue. */ | 194 | /* Next, the write queue. */ |
195 | BUG_TRAP(skb_queue_empty(&sk->sk_write_queue)); | 195 | WARN_ON(!skb_queue_empty(&sk->sk_write_queue)); |
196 | 196 | ||
197 | /* Account for returned memory. */ | 197 | /* Account for returned memory. */ |
198 | sk_mem_reclaim(sk); | 198 | sk_mem_reclaim(sk); |
199 | 199 | ||
200 | BUG_TRAP(!sk->sk_wmem_queued); | 200 | WARN_ON(sk->sk_wmem_queued); |
201 | BUG_TRAP(!sk->sk_forward_alloc); | 201 | WARN_ON(sk->sk_forward_alloc); |
202 | 202 | ||
203 | /* It is _impossible_ for the backlog to contain anything | 203 | /* It is _impossible_ for the backlog to contain anything |
204 | * when we get here. All user references to this socket | 204 | * when we get here. All user references to this socket |
diff --git a/net/core/user_dma.c b/net/core/user_dma.c index c77aff9c6eb3..53c6b67b2877 100644 --- a/net/core/user_dma.c +++ b/net/core/user_dma.c | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | #include <linux/dmaengine.h> | 28 | #include <linux/dmaengine.h> |
29 | #include <linux/socket.h> | 29 | #include <linux/socket.h> |
30 | #include <linux/rtnetlink.h> /* for BUG_TRAP */ | ||
31 | #include <net/tcp.h> | 30 | #include <net/tcp.h> |
32 | #include <net/netdma.h> | 31 | #include <net/netdma.h> |
33 | 32 | ||
@@ -71,7 +70,7 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan, | |||
71 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 70 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
72 | int end; | 71 | int end; |
73 | 72 | ||
74 | BUG_TRAP(start <= offset + len); | 73 | WARN_ON(start > offset + len); |
75 | 74 | ||
76 | end = start + skb_shinfo(skb)->frags[i].size; | 75 | end = start + skb_shinfo(skb)->frags[i].size; |
77 | copy = end - offset; | 76 | copy = end - offset; |
@@ -100,7 +99,7 @@ int dma_skb_copy_datagram_iovec(struct dma_chan *chan, | |||
100 | for (; list; list = list->next) { | 99 | for (; list; list = list->next) { |
101 | int end; | 100 | int end; |
102 | 101 | ||
103 | BUG_TRAP(start <= offset + len); | 102 | WARN_ON(start > offset + len); |
104 | 103 | ||
105 | end = start + list->len; | 104 | end = start + list->len; |
106 | copy = end - offset; | 105 | copy = end - offset; |