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 /net/core | |
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>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 9 | ||||
-rw-r--r-- | net/core/skbuff.c | 15 |
2 files changed, 8 insertions, 16 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 | ||