drm/i915: Correctly return -ENOMEM on allocation failure in cmdbuf ioctls.
Signed-off-by: Owain G. Ainsworth <oga@openbsd.org> Signed-off-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
aacef09b59
commit
a40e8d3139
|
@ -735,8 +735,10 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
|
||||||
if (cmdbuf->num_cliprects) {
|
if (cmdbuf->num_cliprects) {
|
||||||
cliprects = kcalloc(cmdbuf->num_cliprects,
|
cliprects = kcalloc(cmdbuf->num_cliprects,
|
||||||
sizeof(struct drm_clip_rect), GFP_KERNEL);
|
sizeof(struct drm_clip_rect), GFP_KERNEL);
|
||||||
if (cliprects == NULL)
|
if (cliprects == NULL) {
|
||||||
|
ret = -ENOMEM;
|
||||||
goto fail_batch_free;
|
goto fail_batch_free;
|
||||||
|
}
|
||||||
|
|
||||||
ret = copy_from_user(cliprects, cmdbuf->cliprects,
|
ret = copy_from_user(cliprects, cmdbuf->cliprects,
|
||||||
cmdbuf->num_cliprects *
|
cmdbuf->num_cliprects *
|
||||||
|
|
|
@ -3688,8 +3688,10 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
|
||||||
if (args->num_cliprects != 0) {
|
if (args->num_cliprects != 0) {
|
||||||
cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects),
|
cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (cliprects == NULL)
|
if (cliprects == NULL) {
|
||||||
|
ret = -ENOMEM;
|
||||||
goto pre_mutex_err;
|
goto pre_mutex_err;
|
||||||
|
}
|
||||||
|
|
||||||
ret = copy_from_user(cliprects,
|
ret = copy_from_user(cliprects,
|
||||||
(struct drm_clip_rect __user *)
|
(struct drm_clip_rect __user *)
|
||||||
|
|
Loading…
Reference in a new issue