* [PATCH] af_key: make use of BUG_ON macro
@ 2019-06-08 9:00 Hariprasad Kelam
2019-06-10 2:56 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Hariprasad Kelam @ 2019-06-08 9:00 UTC (permalink / raw)
To: Steffen Klassert, Herbert Xu, David S. Miller, netdev, linux-kernel
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>
---
net/key/af_key.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/key/af_key.c b/net/key/af_key.c
index fe5fc4b..b67ed3a 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -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)) {
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] af_key: make use of BUG_ON macro
2019-06-08 9:00 [PATCH] af_key: make use of BUG_ON macro Hariprasad Kelam
@ 2019-06-10 2:56 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-06-10 2:56 UTC (permalink / raw)
To: hariprasad.kelam; +Cc: steffen.klassert, herbert, netdev, linux-kernel
From: Hariprasad Kelam <hariprasad.kelam@gmail.com>
Date: Sat, 8 Jun 2019 14:30:50 +0530
> 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>
Applied to net-next.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-10 2:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-08 9:00 [PATCH] af_key: make use of BUG_ON macro Hariprasad Kelam
2019-06-10 2:56 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).