All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Fix null pointer issue in amdgpu_cs_wait_any_fence
@ 2017-11-09  7:59 Emily Deng
       [not found] ` <1510214382-6807-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Emily Deng @ 2017-11-09  7:59 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Emily Deng

The array[first] may be null when the fence has already been signaled.

BUG: SWDEV-136239

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 354c874..182df08 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1502,8 +1502,11 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev,
 	memset(wait, 0, sizeof(*wait));
 	wait->out.status = (r > 0);
 	wait->out.first_signaled = first;
-	/* set return value 0 to indicate success */
-	r = array[first]->error;
+
+	if (array[first])
+		r = array[first]->error;
+	else
+		r = 0;
 
 err_free_fence_array:
 	for (i = 0; i < fence_count; i++)
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: Fix null pointer issue in amdgpu_cs_wait_any_fence
       [not found] ` <1510214382-6807-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org>
@ 2017-11-09  9:05   ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2017-11-09  9:05 UTC (permalink / raw)
  To: Emily Deng, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 09.11.2017 um 08:59 schrieb Emily Deng:
> The array[first] may be null when the fence has already been signaled.
>
> BUG: SWDEV-136239
>
> Signed-off-by: Emily Deng <Emily.Deng@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 354c874..182df08 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1502,8 +1502,11 @@ static int amdgpu_cs_wait_any_fence(struct amdgpu_device *adev,
>   	memset(wait, 0, sizeof(*wait));
>   	wait->out.status = (r > 0);
>   	wait->out.first_signaled = first;
> -	/* set return value 0 to indicate success */
> -	r = array[first]->error;
> +
> +	if (array[first])
> +		r = array[first]->error;
> +	else
> +		r = 0;
>   
>   err_free_fence_array:
>   	for (i = 0; i < fence_count; i++)


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2017-11-09  9:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09  7:59 [PATCH] drm/amdgpu: Fix null pointer issue in amdgpu_cs_wait_any_fence Emily Deng
     [not found] ` <1510214382-6807-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org>
2017-11-09  9:05   ` Christian König

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.