[PATCH] ipv4: tcp_minisocks: use BUG_ON instead of if condition followed by BUG

Subsystems: networking [general], networking [tcp], the rest

STALE3213d

2 messages, 2 authors, 2017-10-24 · open the first message on its own page

[PATCH] ipv4: tcp_minisocks: use BUG_ON instead of if condition followed by BUG

From: Gustavo A. R. Silva <hidden>
Date: 2017-10-23 18:34:52

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

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <redacted>
---
 net/ipv4/tcp_minisocks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 2341b9f..a952357 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -298,8 +298,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo)
 			key = tp->af_specific->md5_lookup(sk, sk);
 			if (key) {
 				tcptw->tw_md5_key = kmemdup(key, sizeof(*key), GFP_ATOMIC);
-				if (tcptw->tw_md5_key && !tcp_alloc_md5sig_pool())
-					BUG();
+				BUG_ON(tcptw->tw_md5_key && !tcp_alloc_md5sig_pool());
 			}
 		} while (0);
 #endif
-- 
2.7.4

Re: [PATCH] ipv4: tcp_minisocks: use BUG_ON instead of if condition followed by BUG

From: David Miller <davem@davemloft.net>
Date: 2017-10-24 09:45:26

From: "Gustavo A. R. Silva" <redacted>
Date: Mon, 23 Oct 2017 13:10:56 -0500
Use BUG_ON instead of if condition followed by BUG in tcp_time_wait.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help