OSDN Git Service

net: Remove redundant BUG_ON() check in phonet_pernet
authorXu Wang <vulab@iscas.ac.cn>
Fri, 3 Jan 2020 09:20:40 +0000 (09:20 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Jan 2020 20:25:50 +0000 (12:25 -0800)
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.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/phonet/pn_dev.c

index 49bd76a..ac0fae0 100644 (file)
@@ -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);
 }