diff options
author | Owain Ainsworth <zerooa@googlemail.com> | 2010-02-09 09:25:55 -0500 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-02-10 18:08:00 -0500 |
commit | a40e8d3139e9eb54bf1d29f91639a6c5e05f652e (patch) | |
tree | b0dc8c88f3872f57c9b29d76d5f679c2eb90792f /drivers/gpu | |
parent | aacef09b59e99d9e919ede74d107d5d7f3721432 (diff) |
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>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index e660ac07f3b2..2307f98349f7 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -735,8 +735,10 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data, | |||
735 | if (cmdbuf->num_cliprects) { | 735 | if (cmdbuf->num_cliprects) { |
736 | cliprects = kcalloc(cmdbuf->num_cliprects, | 736 | cliprects = kcalloc(cmdbuf->num_cliprects, |
737 | sizeof(struct drm_clip_rect), GFP_KERNEL); | 737 | sizeof(struct drm_clip_rect), GFP_KERNEL); |
738 | if (cliprects == NULL) | 738 | if (cliprects == NULL) { |
739 | ret = -ENOMEM; | ||
739 | goto fail_batch_free; | 740 | goto fail_batch_free; |
741 | } | ||
740 | 742 | ||
741 | ret = copy_from_user(cliprects, cmdbuf->cliprects, | 743 | ret = copy_from_user(cliprects, cmdbuf->cliprects, |
742 | cmdbuf->num_cliprects * | 744 | cmdbuf->num_cliprects * |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 11daa618385f..ec8a0d7ffa39 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -3688,8 +3688,10 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
3688 | if (args->num_cliprects != 0) { | 3688 | if (args->num_cliprects != 0) { |
3689 | cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects), | 3689 | cliprects = kcalloc(args->num_cliprects, sizeof(*cliprects), |
3690 | GFP_KERNEL); | 3690 | GFP_KERNEL); |
3691 | if (cliprects == NULL) | 3691 | if (cliprects == NULL) { |
3692 | ret = -ENOMEM; | ||
3692 | goto pre_mutex_err; | 3693 | goto pre_mutex_err; |
3694 | } | ||
3693 | 3695 | ||
3694 | ret = copy_from_user(cliprects, | 3696 | ret = copy_from_user(cliprects, |
3695 | (struct drm_clip_rect __user *) | 3697 | (struct drm_clip_rect __user *) |