aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_kms.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_kms.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 880e285d7578..37d40545ed77 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -1809,7 +1809,8 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
1809 } 1809 }
1810 1810
1811 rects_size = arg->num_outputs * sizeof(struct drm_vmw_rect); 1811 rects_size = arg->num_outputs * sizeof(struct drm_vmw_rect);
1812 rects = kzalloc(rects_size, GFP_KERNEL); 1812 rects = kcalloc(arg->num_outputs, sizeof(struct drm_vmw_rect),
1813 GFP_KERNEL);
1813 if (unlikely(!rects)) { 1814 if (unlikely(!rects)) {
1814 ret = -ENOMEM; 1815 ret = -ENOMEM;
1815 goto out_unlock; 1816 goto out_unlock;
@@ -1824,10 +1825,10 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
1824 } 1825 }
1825 1826
1826 for (i = 0; i < arg->num_outputs; ++i) { 1827 for (i = 0; i < arg->num_outputs; ++i) {
1827 if (rects->x < 0 || 1828 if (rects[i].x < 0 ||
1828 rects->y < 0 || 1829 rects[i].y < 0 ||
1829 rects->x + rects->w > mode_config->max_width || 1830 rects[i].x + rects[i].w > mode_config->max_width ||
1830 rects->y + rects->h > mode_config->max_height) { 1831 rects[i].y + rects[i].h > mode_config->max_height) {
1831 DRM_ERROR("Invalid GUI layout.\n"); 1832 DRM_ERROR("Invalid GUI layout.\n");
1832 ret = -EINVAL; 1833 ret = -EINVAL;
1833 goto out_free; 1834 goto out_free;