drm/vmwgfx: Fix depth input into drm_mode_legacy_fb_format
authorSinclair Yeh <syeh@vmware.com>
Wed, 18 Jan 2017 22:14:01 +0000 (14:14 -0800)
committerSinclair Yeh <syeh@vmware.com>
Fri, 27 Jan 2017 04:52:54 +0000 (20:52 -0800)
Currently the pitch is passed in as depth.  This causes
drm_mode_legacy_fb_format() to return the wrong pixel format.

The wrong pixel format will be rejected by vmw_kms_new_framebuffer(),
thus leaving par->set_fb to NULL.

This eventually causes a crash in vmw_fb_setcolreg() when the code
tries to dereference par->set_fb.

Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c

index 867a8442220c23294ff2862578e2c3785e96ee94..e9005b9a5e8c513b0aec0dfbe36e06aa1fbf1eae 100644 (file)
@@ -482,8 +482,7 @@ static int vmw_fb_kms_framebuffer(struct fb_info *info)
        mode_cmd.height = var->yres;
        mode_cmd.pitches[0] = ((var->bits_per_pixel + 7) / 8) * mode_cmd.width;
        mode_cmd.pixel_format =
-               drm_mode_legacy_fb_format(var->bits_per_pixel,
-                       ((var->bits_per_pixel + 7) / 8) * mode_cmd.width);
+               drm_mode_legacy_fb_format(var->bits_per_pixel, depth);
 
        cur_fb = par->set_fb;
        if (cur_fb && cur_fb->width == mode_cmd.width &&