Commit 4c0e5528 authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: fix NULL deref in the load detect code

Looks like I've missed one of the potential NULL deref bugs in Jesse's
fbdev->fb embedded struct to pointer conversions. Fix it up.

This regression has been introduced in

commit 8bcd4553
Author: Jesse Barnes <jbarnes@virtuousgeek.org>
Date:   Fri Feb 7 12:10:38 2014 -0800

    drm/i915: alloc intel_fb in the intel_fbdev struct

Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 8ea99c92
...@@ -7754,13 +7754,15 @@ mode_fits_in_fbdev(struct drm_device *dev, ...@@ -7754,13 +7754,15 @@ mode_fits_in_fbdev(struct drm_device *dev,
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
if (dev_priv->fbdev == NULL) if (!dev_priv->fbdev)
return NULL; return NULL;
obj = dev_priv->fbdev->fb->obj; if (!dev_priv->fbdev->fb)
if (obj == NULL)
return NULL; return NULL;
obj = dev_priv->fbdev->fb->obj;
BUG_ON(!obj);
fb = &dev_priv->fbdev->fb->base; fb = &dev_priv->fbdev->fb->base;
if (fb->pitches[0] < intel_framebuffer_pitch_for_width(mode->hdisplay, if (fb->pitches[0] < intel_framebuffer_pitch_for_width(mode->hdisplay,
fb->bits_per_pixel)) fb->bits_per_pixel))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment