Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1352952 > unrolled thread
| Started by | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| First post | 2016-03-08 13:20 +0100 |
| Last post | 2016-03-14 02:20 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[patch] drm/vc4: Return -EFAULT on copy_from_user() failure Dan Carpenter <dan.carpenter@oracle.com> - 2016-03-08 13:20 +0100
Re: [patch] drm/vc4: Return -EFAULT on copy_from_user() failure Eric Anholt <eric@anholt.net> - 2016-03-14 02:20 +0100
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2016-03-08 13:20 +0100 |
| Subject | [patch] drm/vc4: Return -EFAULT on copy_from_user() failure |
| Message-ID | <raoMj-Hp-27@gated-at.bofh.it> |
The copy_from_user() function returns the number of bytes not copied but
we want to return a negative error code.
Fixes: 463873d57014 ('drm/vc4: Add an API for creating GPU shaders in GEM BOs.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
index 034ef2d..9807bc9 100644
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -498,11 +498,12 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data,
if (IS_ERR(bo))
return PTR_ERR(bo);
- ret = copy_from_user(bo->base.vaddr,
+ if (copy_from_user(bo->base.vaddr,
(void __user *)(uintptr_t)args->data,
- args->size);
- if (ret != 0)
+ args->size)) {
+ ret = -EFAULT;
goto fail;
+ }
/* Clear the rest of the memory from allocating from the BO
* cache.
*/
[toc] | [next] | [standalone]
| From | Eric Anholt <eric@anholt.net> |
|---|---|
| Date | 2016-03-14 02:20 +0100 |
| Message-ID | <rcpkS-54L-9@gated-at.bofh.it> |
| In reply to | #1352952 |
[Multipart message — attachments visible in raw view] — view raw
Dan Carpenter <dan.carpenter@oracle.com> writes:
> The copy_from_user() function returns the number of bytes not copied but
> we want to return a negative error code.
>
> Fixes: 463873d57014 ('drm/vc4: Add an API for creating GPU shaders in GEM BOs.')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Pulled. Thanks!
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web