All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos()
@ 2016-10-13  8:54 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2016-10-13  8:54 UTC (permalink / raw)
  To: Eric Anholt; +Cc: kernel-janitors, dri-devel

If the allocation fails the current code returns success.  If
copy_from_user() fails it returns the number of bytes remaining instead
of -EFAULT.

Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index 47a095f..303f23c 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -544,14 +544,15 @@ vc4_cl_lookup_bos(struct drm_device *dev,
 
 	handles = drm_malloc_ab(exec->bo_count, sizeof(uint32_t));
 	if (!handles) {
+		ret = -ENOMEM;
 		DRM_ERROR("Failed to allocate incoming GEM handles\n");
 		goto fail;
 	}
 
-	ret = copy_from_user(handles,
-			     (void __user *)(uintptr_t)args->bo_handles,
-			     exec->bo_count * sizeof(uint32_t));
-	if (ret) {
+	if (copy_from_user(handles,
+			   (void __user *)(uintptr_t)args->bo_handles,
+			   exec->bo_count * sizeof(uint32_t))) {
+		ret = -EFAULT;
 		DRM_ERROR("Failed to copy in GEM handles\n");
 		goto fail;
 	}

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patch] drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos()
@ 2016-10-13  8:54 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2016-10-13  8:54 UTC (permalink / raw)
  To: Eric Anholt; +Cc: kernel-janitors, dri-devel

If the allocation fails the current code returns success.  If
copy_from_user() fails it returns the number of bytes remaining instead
of -EFAULT.

Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index 47a095f..303f23c 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -544,14 +544,15 @@ vc4_cl_lookup_bos(struct drm_device *dev,
 
 	handles = drm_malloc_ab(exec->bo_count, sizeof(uint32_t));
 	if (!handles) {
+		ret = -ENOMEM;
 		DRM_ERROR("Failed to allocate incoming GEM handles\n");
 		goto fail;
 	}
 
-	ret = copy_from_user(handles,
-			     (void __user *)(uintptr_t)args->bo_handles,
-			     exec->bo_count * sizeof(uint32_t));
-	if (ret) {
+	if (copy_from_user(handles,
+			   (void __user *)(uintptr_t)args->bo_handles,
+			   exec->bo_count * sizeof(uint32_t))) {
+		ret = -EFAULT;
 		DRM_ERROR("Failed to copy in GEM handles\n");
 		goto fail;
 	}
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [patch] drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos()
  2016-10-13  8:54 ` Dan Carpenter
@ 2016-10-13 17:33   ` Eric Anholt
  -1 siblings, 0 replies; 6+ messages in thread
From: Eric Anholt @ 2016-10-13 17:33 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, dri-devel

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

Dan Carpenter <dan.carpenter@oracle.com> writes:

> If the allocation fails the current code returns success.  If
> copy_from_user() fails it returns the number of bytes remaining instead
> of -EFAULT.
>
> Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Looks good.  Waiting for rc1 to show up to put together a -next.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos()
@ 2016-10-13 17:33   ` Eric Anholt
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Anholt @ 2016-10-13 17:33 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 398 bytes --]

Dan Carpenter <dan.carpenter@oracle.com> writes:

> If the allocation fails the current code returns success.  If
> copy_from_user() fails it returns the number of bytes remaining instead
> of -EFAULT.
>
> Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Looks good.  Waiting for rc1 to show up to put together a -next.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos()
  2016-10-13  8:54 ` Dan Carpenter
@ 2016-10-17 17:09   ` Eric Anholt
  -1 siblings, 0 replies; 6+ messages in thread
From: Eric Anholt @ 2016-10-17 17:09 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, dri-devel

[-- Attachment #1: Type: text/plain, Size: 380 bytes --]

Dan Carpenter <dan.carpenter@oracle.com> writes:

> If the allocation fails the current code returns success.  If
> copy_from_user() fails it returns the number of bytes remaining instead
> of -EFAULT.
>
> Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed and applied to drm-vc4-next.  Thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos()
@ 2016-10-17 17:09   ` Eric Anholt
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Anholt @ 2016-10-17 17:09 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kernel-janitors, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 380 bytes --]

Dan Carpenter <dan.carpenter@oracle.com> writes:

> If the allocation fails the current code returns success.  If
> copy_from_user() fails it returns the number of bytes remaining instead
> of -EFAULT.
>
> Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed and applied to drm-vc4-next.  Thanks!

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-17 17:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-13  8:54 [patch] drm/vc4: Fix a couple error codes in vc4_cl_lookup_bos() Dan Carpenter
2016-10-13  8:54 ` Dan Carpenter
2016-10-13 17:33 ` Eric Anholt
2016-10-13 17:33   ` Eric Anholt
2016-10-17 17:09 ` Eric Anholt
2016-10-17 17:09   ` Eric Anholt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.