Skip to content

Commit

Permalink
staging: slicoss: fix a null deref when pci_alloc_consistent fail
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Devendra Naga authored and Greg Kroah-Hartman committed Sep 5, 2012
1 parent 8f6f4c1 commit b8131fc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/staging/slicoss/slicoss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit b8131fc

Please sign in to comment.