diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_execbuffer.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_execbuffer.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 68ec0130a626..c77bfa9ad340 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -1116,6 +1116,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
1116 | return -EINVAL; | 1116 | return -EINVAL; |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | if (args->num_cliprects > UINT_MAX / sizeof(*cliprects)) { | ||
1120 | DRM_DEBUG("execbuf with %u cliprects\n", | ||
1121 | args->num_cliprects); | ||
1122 | return -EINVAL; | ||
1123 | } | ||
1119 | cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects), | 1124 | cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects), |
1120 | GFP_KERNEL); | 1125 | GFP_KERNEL); |
1121 | if (cliprects == NULL) { | 1126 | if (cliprects == NULL) { |
@@ -1387,7 +1392,8 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data, | |||
1387 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; | 1392 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; |
1388 | int ret; | 1393 | int ret; |
1389 | 1394 | ||
1390 | if (args->buffer_count < 1) { | 1395 | if (args->buffer_count < 1 || |
1396 | args->buffer_count > UINT_MAX / sizeof(*exec2_list)) { | ||
1391 | DRM_DEBUG("execbuf2 with %d buffers\n", args->buffer_count); | 1397 | DRM_DEBUG("execbuf2 with %d buffers\n", args->buffer_count); |
1392 | return -EINVAL; | 1398 | return -EINVAL; |
1393 | } | 1399 | } |