Skip to content

Commit

Permalink
net/core: Fix BUG to BUG_ON conditionals.
Browse files Browse the repository at this point in the history
Fix BUG() calls to use BUG_ON(conditional) macros.

This was found using make coccicheck M=net/core on linux next
tag next-2017092

Signed-off-by: Tim Hansen <devtimhansen@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tim Hansen authored and David S. Miller committed Oct 10, 2017
1 parent 67174bb commit 9f77fad
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1350,8 +1350,7 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
/* Set the tail pointer and length */
skb_put(n, skb->len);

if (skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len))
BUG();
BUG_ON(skb_copy_bits(skb, -headerlen, n->head, headerlen + skb->len));

copy_skb_header(n, skb);
return n;
Expand Down Expand Up @@ -1449,8 +1448,7 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,

BUG_ON(nhead < 0);

if (skb_shared(skb))
BUG();
BUG_ON(skb_shared(skb));

size = SKB_DATA_ALIGN(size);

Expand Down Expand Up @@ -1595,9 +1593,8 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
head_copy_off = newheadroom - head_copy_len;

/* Copy the linear header and data. */
if (skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
skb->len + head_copy_len))
BUG();
BUG_ON(skb_copy_bits(skb, -head_copy_len, n->head + head_copy_off,
skb->len + head_copy_len));

copy_skb_header(n, skb);

Expand Down Expand Up @@ -1878,8 +1875,8 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta)
return NULL;
}

if (skb_copy_bits(skb, skb_headlen(skb), skb_tail_pointer(skb), delta))
BUG();
BUG_ON(skb_copy_bits(skb, skb_headlen(skb),
skb_tail_pointer(skb), delta));

/* Optimization: no fragments, no reasons to preestimate
* size of pulled pages. Superb.
Expand Down

0 comments on commit 9f77fad

Please sign in to comment.