DORMANTno replies

[PATCH net-next] net: use BUG_ON instead of if condition followed by BUG

From: Zheng Yongjun <hidden>
Date: 2021-06-07 08:57:40
Also in: lkml
Subsystem: networking [general], networking [ipv4/ipv6], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds

Use BUG_ON instead of if condition followed by BUG in ip_frag_next.

This issue was detected with the help of Coccinelle.

Signed-off-by: Zheng Yongjun <redacted>
---
 net/ipv4/ip_output.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index c3efc7d658f6..9d0a7e8beaa8 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -734,8 +734,7 @@ struct sk_buff *ip_frag_next(struct sk_buff *skb, struct ip_frag_state *state)
 	/*
 	 *	Copy a block of the IP datagram.
 	 */
-	if (skb_copy_bits(skb, state->ptr, skb_transport_header(skb2), len))
-		BUG();
+	BUG_ON(skb_copy_bits(skb, state->ptr, skb_transport_header(skb2), len));
 	state->left -= len;
 
 	/*
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help