Skip to contentSkip to conversation

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

PATCH Applied Gustavo A. R. Silva 2 participants 2 messages Oct 23, 2017 – Oct 24, 2017

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

PATCH 1/1 ipv4: tcp_minisocks: use BUG_ON instead of if condition followed by BUG

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

This issue was detected with the help of Coccinelle.

---
 net/ipv4/tcp_minisocks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv4/tcp_minisocks.c +1 -2
index 2341b9f..a952357 100644
@@ -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
Signature · 1 line
2.7.4