Skip to contentSkip to conversation

net: Remove redundant BUG_ON() check in phonet_pernet

PATCH Applied Xu Wang 2 participants 2 messages Jan 3, 2020

Subsystems (3)
lore
Share & tools
lore

Xu Wang

author
#0 lore raw

PATCH 1/1 net: Remove redundant BUG_ON() check in phonet_pernet

Passing NULL to phonet_pernet causes a crash via BUG_ON. Dereferencing net in net_generic() also has the same effect. This patch removes the redundant BUG_ON check on the same parameter.

---
 net/phonet/pn_dev.c | 2 --
 1 file changed, 2 deletions(-)
net/phonet/pn_dev.c +0 -2
index 49bd76a..ac0fae0 100644
@@ -35,8 +35,6 @@ static unsigned int phonet_net_id __read_mostly;
 
 static struct phonet_net *phonet_pernet(struct net *net)
 {
-	BUG_ON(!net);
-
 	return net_generic(net, phonet_net_id);
 }
 
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw

From: Xu Wang <[email protected]>
Date: Fri, 3 Jan 2020 09:20:40 +0000

Quoted 5 lines

Passing NULL to phonet_pernet causes a crash via BUG_ON. Dereferencing net in net_generic() also has the same effect. This patch removes the redundant BUG_ON check on the same parameter.

Applied.