staging: slicoss: fix a null deref when pci_alloc_consistent fail
authorDevendra Naga <devendra.aaru@gmail.com>
Wed, 5 Sep 2012 10:03:47 +0000 (15:33 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Sep 2012 18:59:51 +0000 (11:59 -0700)
we are dereferencing the pshmem , and the pci_alloc_consistent can fail
returning null,

do a memcpy if we have a valid pshmem

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/slicoss/slicoss.c

index 0755bc1..cd920da 100644 (file)
@@ -3701,9 +3701,8 @@ static void slic_init_adapter(struct net_device *netdev,
                                        phys_shmem);
        ASSERT(adapter->pshmem);
 
-       memset(adapter->pshmem, 0, sizeof(struct slic_shmem));
-
-       return;
+       if (adapter->pshmem)
+               memset(adapter->pshmem, 0, sizeof(struct slic_shmem));
 }
 
 static const struct net_device_ops slic_netdev_ops = {