NET: ipv6, remove unnecessary check
authorJiri Slaby <jslaby@suse.cz>
Sun, 10 Jan 2010 00:43:03 +0000 (00:43 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 10 Jan 2010 21:27:57 +0000 (13:27 -0800)
Stanse found a potential null dereference in snmp6_unregister_dev.
There is a check for idev being NULL, but it is dereferenced
earlier. But idev cannot be NULL when passed to
snmp6_unregister_dev, so remove the test.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: "Pekka Savola (ipv6)" <pekkas@netcore.fi>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/proc.c

index c9605c3ad91fcf8927c4df2937fa10c8b8dafd94..7b197b7132e012c8767e1303aa1212375095cd63 100644 (file)
@@ -259,7 +259,7 @@ int snmp6_unregister_dev(struct inet6_dev *idev)
        struct net *net = dev_net(idev->dev);
        if (!net->mib.proc_net_devsnmp6)
                return -ENOENT;
-       if (!idev || !idev->stats.proc_dir_entry)
+       if (!idev->stats.proc_dir_entry)
                return -EINVAL;
        remove_proc_entry(idev->stats.proc_dir_entry->name,
                          net->mib.proc_net_devsnmp6);