mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
drm/vmwgfx: Fix order of operation
commit 7851496a32 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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c170833402
commit
55d851a914
@@ -574,7 +574,7 @@ static int vmw_fb_set_par(struct fb_info *info)
|
|||||||
old_mode = NULL;
|
old_mode = NULL;
|
||||||
} else if (!vmw_kms_validate_mode_vram(vmw_priv,
|
} else if (!vmw_kms_validate_mode_vram(vmw_priv,
|
||||||
mode->hdisplay *
|
mode->hdisplay *
|
||||||
(var->bits_per_pixel + 7) / 8,
|
DIV_ROUND_UP(var->bits_per_pixel, 8),
|
||||||
mode->vdisplay)) {
|
mode->vdisplay)) {
|
||||||
drm_mode_destroy(vmw_priv->dev, mode);
|
drm_mode_destroy(vmw_priv->dev, mode);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
Reference in New Issue
Block a user