Skip to content

Commit de47c5d

Browse files
Hariprasad Kelamdavem330
authored andcommitted
af_key: make use of BUG_ON macro
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>
1 parent 3920967 commit de47c5d

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

‎net/key/af_key.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(const struct xfrm_state *x,
928928
pfkey_sockaddr_fill(&x->props.saddr, 0,
929929
(struct sockaddr *) (addr + 1),
930930
x->props.family);
931-
if (!addr->sadb_address_prefixlen)
932-
BUG();
931+
BUG_ON(!addr->sadb_address_prefixlen);
933932

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

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

0 commit comments

Comments
 (0)