Skip to contentSkip to conversation

af_key: make use of BUG_ON macro

PATCH Applied Hariprasad Kelam 2 participants 2 messages Jun 8, 2019 – Jun 10, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 net/key/af_key.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/key/af_key.c +2 -4
index fe5fc4b..b67ed3a 100644
@@ -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);
@@ -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)) {
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw

From: Hariprasad Kelam <[email protected]>
Date: Sat, 8 Jun 2019 14:30:50 +0530

Quoted 8 lines

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.

Applied to net-next.