aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_framebuffer.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2016-11-18 21:52:58 +0200
committerVille Syrjälä <ville.syrjala@linux.intel.com>2016-12-15 14:55:30 +0200
commit570cec3244447f21f5b24c3a75151b4166e30d95 (patch)
tree91a269fb799c4a7c90f6aef0b4a59f38fa0e3e4d /drivers/gpu/drm/drm_framebuffer.c
parentdrm/i915: Populate fb->format early for inherited fbs (diff)
downloadlinux-dev-570cec3244447f21f5b24c3a75151b4166e30d95.tar.xz
linux-dev-570cec3244447f21f5b24c3a75151b4166e30d95.zip
drm: Reject fbs w/o format info in drm_framebuffer_init()
Any framebuffer that doesn't have proper format information when drm_framebuffer_init() is called is a bug. Let's warn and return an error to avoid oopsing the kernel later due to dereferencing the NULL fb->format pointer. Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1479498793-31021-23-git-send-email-ville.syrjala@linux.intel.com Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/gpu/drm/drm_framebuffer.c')
-rw-r--r--drivers/gpu/drm/drm_framebuffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index f397565d3c20..892976d974e5 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -631,7 +631,7 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,
{
int ret;
- if (WARN_ON_ONCE(fb->dev != dev))
+ if (WARN_ON_ONCE(fb->dev != dev || !fb->format))
return -EINVAL;
INIT_LIST_HEAD(&fb->filp_head);