diff options
| author | Sinclair Yeh <syeh@vmware.com> | 2016-04-21 14:29:31 -0400 |
|---|---|---|
| committer | Sinclair Yeh <syeh@vmware.com> | 2016-04-28 14:07:30 -0400 |
| commit | 7851496a32319237456919575e5f4ba62f74cc7d (patch) | |
| tree | 3115350947df1fcf593116917c7d9c4bbb0f8aa1 /drivers/gpu | |
| parent | e02e58843153ce80a9fe7588def89b2638d40e64 (diff) | |
drm/vmwgfx: Fix order of operation
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>
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c index 3b1faf7862a5..679a4cb98ee3 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) | |||
| 573 | mode = old_mode; | 573 | mode = old_mode; |
| 574 | old_mode = NULL; | 574 | old_mode = NULL; |
| 575 | } else if (!vmw_kms_validate_mode_vram(vmw_priv, | 575 | } else if (!vmw_kms_validate_mode_vram(vmw_priv, |
| 576 | mode->hdisplay * | 576 | mode->hdisplay * |
| 577 | (var->bits_per_pixel + 7) / 8, | 577 | DIV_ROUND_UP(var->bits_per_pixel, 8), |
| 578 | mode->vdisplay)) { | 578 | mode->vdisplay)) { |
| 579 | drm_mode_destroy(vmw_priv->dev, mode); | 579 | drm_mode_destroy(vmw_priv->dev, mode); |
| 580 | return -EINVAL; | 580 | return -EINVAL; |
| 581 | } | 581 | } |
