summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2019-12-16 16:21:36 +0000
committerPatrik Jakobsson <patrik.r.jakobsson@gmail.com>2019-12-19 15:33:40 +0100
commit7da5492739db745d935a7044288a7307a0fb7f29 (patch)
tree4524d43aad2223bf1baa69f8ec78e0e642d8da8c /drivers/gpu/drm
parent24f03be4aa7922ef5c6067d2809c5d90dfe275c9 (diff)
downloadlinux-7da5492739db745d935a7044288a7307a0fb7f29.tar.bz2
drm/gma500: fix null dereference of pointer fb before null check
Pointer fb is being dereferenced when assigning dev before it is null checked. Fix this by only dereferencing dev after the null check. Fixes: 6b7ce2c4161a ("drm/gma500: Remove struct psb_fbdev") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191216162136.270114-1-colin.king@canonical.com
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/gma500/accel_2d.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/gma500/accel_2d.c b/drivers/gpu/drm/gma500/accel_2d.c
index b9e5a38632f7..adc0507545bf 100644
--- a/drivers/gpu/drm/gma500/accel_2d.c
+++ b/drivers/gpu/drm/gma500/accel_2d.c
@@ -228,8 +228,8 @@ static void psbfb_copyarea_accel(struct fb_info *info,
{
struct drm_fb_helper *fb_helper = info->par;
struct drm_framebuffer *fb = fb_helper->fb;
- struct drm_device *dev = fb->dev;
- struct drm_psb_private *dev_priv = dev->dev_private;
+ struct drm_device *dev;
+ struct drm_psb_private *dev_priv;
uint32_t offset;
uint32_t stride;
uint32_t src_format;
@@ -238,6 +238,8 @@ static void psbfb_copyarea_accel(struct fb_info *info,
if (!fb)
return;
+ dev = fb->dev;
+ dev_priv = dev->dev_private;
offset = to_gtt_range(fb->obj[0])->offset;
stride = fb->pitches[0];