diff mbox series

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

Message ID 20210607091112.2766745-1-zhengyongjun3@huawei.com
State New
Headers show
Series [net-next] net: use BUG_ON instead of if condition followed by BUG | expand

Commit Message

Zheng Yongjun June 7, 2021, 9:11 a.m. UTC
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 <zhengyongjun3@huawei.com>
---
 net/ipv4/ip_output.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

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;
 
 	/*