Skip to content

Commit

Permalink
drm/mgag200: fix null pointer dereference
Browse files Browse the repository at this point in the history
we are referencing the pointer after doing alloc_apertures,
as alloc_apertures kzallocs, the kzalloc may fail and we get a NULL.

so we need to check for NULL before we dereference this pointer

Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Devendra Naga authored and airlied committed Jul 20, 2012
1 parent f60ec4c commit 4dbdf0a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/mgag200/mgag200_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ static void mgag200_kick_out_firmware_fb(struct pci_dev *pdev)
bool primary = false;

ap = alloc_apertures(1);
if (!ap)
return;

ap->ranges[0].base = pci_resource_start(pdev, 0);
ap->ranges[0].size = pci_resource_len(pdev, 0);

Expand Down

0 comments on commit 4dbdf0a

Please sign in to comment.