drm/i915: Correctly return -ENOMEM on allocation failure in cmdbuf ioctls.
authorOwain Ainsworth <zerooa@googlemail.com>
Tue, 9 Feb 2010 14:25:55 +0000 (14:25 +0000)
committerEric Anholt <eric@anholt.net>
Wed, 10 Feb 2010 23:08:00 +0000 (15:08 -0800)
Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_gem.c

index e660ac07f3b247f33402b0b415d073811c627d84..2307f98349f7d145aec2a0d57c57a86777a3cbb6 100644 (file)
@@ -735,8 +735,10 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
        if (cmdbuf->num_cliprects) {
                cliprects = kcalloc(cmdbuf->num_cliprects,
                                    sizeof(struct drm_clip_rect), GFP_KERNEL);
-               if (cliprects == NULL)
+               if (cliprects == NULL) {
+                       ret = -ENOMEM;
                        goto fail_batch_free;
+               }
 
                ret = copy_from_user(cliprects, cmdbuf->cliprects,
                                     cmdbuf->num_cliprects *
index 11daa618385fb454cbf272efe509d20147697c0f..ec8a0d7ffa3990ea9f7ded8871f3ff384b2bf24d 100644 (file)
@@ -3688,8 +3688,10 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
        if (args->num_cliprects != 0) {
                cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects),
                                    GFP_KERNEL);
-               if (cliprects == NULL)
+               if (cliprects == NULL) {
+                       ret = -ENOMEM;
                        goto pre_mutex_err;
+               }
 
                ret = copy_from_user(cliprects,
                                     (struct drm_clip_rect __user *)