From: Devendra Naga Date: Wed, 5 Sep 2012 10:03:47 +0000 (+0530) Subject: staging: slicoss: fix a null deref when pci_alloc_consistent fail X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b8131fc0e1c37563c278743e6def971be993cdda;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git staging: slicoss: fix a null deref when pci_alloc_consistent fail 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c index 0755bc14229c..cd920dad85cd 100644 --- a/drivers/staging/slicoss/slicoss.c +++ b/drivers/staging/slicoss/slicoss.c @@ -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 = {