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 <segoon@openwall.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Vasiliy Kulikov 2010-11-18 10:35:58 -08:00 committed by David S. Miller
parent 7d8e76bf9a
commit 8ea91226ec
1 changed files with 2 additions and 2 deletions

View 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);