From: Vasiliy Kulikov Date: Thu, 18 Nov 2010 18:35:58 +0000 (-0800) Subject: net: caif: spi: fix potential NULL dereference X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=8ea91226eccf6c8ab9c55054b24c21021d4d9d19;p=openwrt%2Fstaging%2Fblogic.git net: caif: spi: fix potential NULL dereference 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c index 8b4cea57a6c5..20da1996d354 100644 --- a/drivers/net/caif/caif_spi.c +++ b/drivers/net/caif/caif_spi.c @@ -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);