Skip to content

Commit

Permalink
drm/i915: fix NULL deref in the load detect code
Browse files Browse the repository at this point in the history
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 8bcd455
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: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Daniel Vetter committed Feb 14, 2014
1 parent 8ea99c9 commit 4c0e552
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/gpu/drm/i915/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -7754,13 +7754,15 @@ mode_fits_in_fbdev(struct drm_device *dev,
struct drm_i915_gem_object *obj;
struct drm_framebuffer *fb;

if (dev_priv->fbdev == NULL)
if (!dev_priv->fbdev)
return NULL;

obj = dev_priv->fbdev->fb->obj;
if (obj == NULL)
if (!dev_priv->fbdev->fb)
return NULL;

obj = dev_priv->fbdev->fb->obj;
BUG_ON(!obj);

fb = &dev_priv->fbdev->fb->base;
if (fb->pitches[0] < intel_framebuffer_pitch_for_width(mode->hdisplay,
fb->bits_per_pixel))
Expand Down

0 comments on commit 4c0e552

Please sign in to comment.