stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch "drm/vmwgfx: Fix order of operation" has been added to the 4.4-stable tree
@ 2016-06-04 20:54 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-06-04 20:54 UTC (permalink / raw)
  To: syeh, gregkh, thellstrom; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    drm/vmwgfx: Fix order of operation

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-vmwgfx-fix-order-of-operation.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 7851496a32319237456919575e5f4ba62f74cc7d Mon Sep 17 00:00:00 2001
From: Sinclair Yeh <syeh@vmware.com>
Date: Thu, 21 Apr 2016 11:29:31 -0700
Subject: drm/vmwgfx: Fix order of operation

From: Sinclair Yeh <syeh@vmware.com>

commit 7851496a32319237456919575e5f4ba62f74cc7d upstream.

mode->hdisplay * (var->bits_per_pixel + 7) gets evaluated before
the division, potentially making the pitch larger than it should
be.

Since the original intention is to do a div-round-up, just use
the macro instead.

Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -573,9 +573,9 @@ static int vmw_fb_set_par(struct fb_info
 		mode = old_mode;
 		old_mode = NULL;
 	} else if (!vmw_kms_validate_mode_vram(vmw_priv,
-					       mode->hdisplay *
-					       (var->bits_per_pixel + 7) / 8,
-					       mode->vdisplay)) {
+					mode->hdisplay *
+					DIV_ROUND_UP(var->bits_per_pixel, 8),
+					mode->vdisplay)) {
 		drm_mode_destroy(vmw_priv->dev, mode);
 		return -EINVAL;
 	}


Patches currently in stable-queue which might be from syeh@vmware.com are

queue-4.4/drm-vmwgfx-use-vmw_cmd_dx_cid_check-for-query-commands.patch
queue-4.4/drm-vmwgfx-fix-order-of-operation.patch
queue-4.4/drm-vmwgfx-enable-svga_3d_cmd_dx_set_predication.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-04 20:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-04 20:54 Patch "drm/vmwgfx: Fix order of operation" has been added to the 4.4-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).