Skip to content

Commit

Permalink
af_key: make use of BUG_ON macro
Browse files Browse the repository at this point in the history
fix below warnings reported by coccicheck

net/key/af_key.c:932:2-5: WARNING: Use BUG_ON instead of if condition
followed by BUG.
net/key/af_key.c:948:2-5: WARNING: Use BUG_ON instead of if condition
followed by BUG.

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Hariprasad Kelam authored and davem330 committed Jun 10, 2019
1 parent 3920967 commit de47c5d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/key/af_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x,
pfkey_sockaddr_fill(&x->props.saddr, 0,
(struct sockaddr *) (addr + 1),
x->props.family);
if (!addr->sadb_address_prefixlen)
BUG();
BUG_ON(!addr->sadb_address_prefixlen);

/* dst address */
addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size);
Expand All @@ -944,8 +943,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x,
pfkey_sockaddr_fill(&x->id.daddr, 0,
(struct sockaddr *) (addr + 1),
x->props.family);
if (!addr->sadb_address_prefixlen)
BUG();
BUG_ON(!addr->sadb_address_prefixlen);

if (!xfrm_addr_equal(&x->sel.saddr, &x->props.saddr,
x->props.family)) {
Expand Down

0 comments on commit de47c5d

Please sign in to comment.