]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
net: caif: spi: fix potential NULL dereference
authorVasiliy Kulikov <segoon@openwall.com>
Thu, 18 Nov 2010 18:35:58 +0000 (10:35 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 Nov 2010 18:35:58 +0000 (10:35 -0800)
alloc_netdev() is not checked here for NULL return value.  dev is
check instead.  It might lead to NULL dereference of ndev.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/caif/caif_spi.c

index 8b4cea57a6c5c47f585f5fcae935771e575dcd18..20da1996d354d563d8a2616276de477041b2368d 100644 (file)
@@ -635,8 +635,8 @@ int cfspi_spi_probe(struct platform_device *pdev)
 
        ndev = alloc_netdev(sizeof(struct cfspi),
                        "cfspi%d", cfspi_setup);
-       if (!dev)
-               return -ENODEV;
+       if (!ndev)
+               return -ENOMEM;
 
        cfspi = netdev_priv(ndev);
        netif_stop_queue(ndev);