summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevendra Naga <devendra.aaru@gmail.com>2012-07-07 11:22:15 +0200
committerDave Airlie <airlied@redhat.com>2012-07-20 04:05:25 +0200
commit4dbdf0aea9585add9359e7ca5535256f866ec85c (patch)
tree145d64cae53ae09aa5e74c3774f89cfd3e4a1f25
parentdrm/radeon: Try harder to avoid HW cursor ending on a multiple of 128 columns. (diff)
downloadlinux-4dbdf0aea9585add9359e7ca5535256f866ec85c.tar.xz
linux-4dbdf0aea9585add9359e7ca5535256f866ec85c.zip
drm/mgag200: fix null pointer dereference
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>
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_drv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 93e832d6c328..ea1024d79974 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -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);