From: "Sinclair Yeh" <syeh@vmware.com>
To: stable@vger.kernel.org
Cc: Sinclair Yeh <syeh@vmware.com>
Subject: [PATCH 3/3] drm/vmwgfx: Fix order of operation
Date: Tue, 31 May 2016 11:17:14 -0700 [thread overview]
Message-ID: <1464718634-4494-3-git-send-email-syeh@vmware.com> (raw)
In-Reply-To: <1464718634-4494-1-git-send-email-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>
Cc: <stable@vger.kernel.org> # 4.4.10-
---
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index 3b1faf7..679a4cb 100644
--- 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 *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;
}
--
2.8.2
prev parent reply other threads:[~2016-05-31 18:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 18:17 [PATCH 1/3] drm/vmwgfx: Enable SVGA_3D_CMD_DX_SET_PREDICATION Sinclair Yeh
2016-05-31 18:17 ` [PATCH 2/3] drm/vmwgfx: use vmw_cmd_dx_cid_check for query commands Sinclair Yeh
2016-05-31 18:17 ` Sinclair Yeh [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464718634-4494-3-git-send-email-syeh@vmware.com \
--to=syeh@vmware.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox