dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs()
@ 2017-09-30  8:13 Dan Carpenter
  2017-09-30  8:14 ` [PATCH 2/2] drm/amdgpu: Potential uninitialized variable in amdgpu_vm_update_directories() Dan Carpenter
  2017-09-30  8:25 ` [PATCH 1/2] drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs() Christian König
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2017-09-30  8:13 UTC (permalink / raw)
  To: Alex Deucher, Christian König
  Cc: David Airlie, Xiangliang Yu, Leo Liu, Frank Min, Junwei Zhang,
	Chris Wilson, amd-gfx, dri-devel, kernel-janitors

We shifted some code around in commit 9cca0b8e5df0 ("drm/amdgpu: move
amdgpu_cs_sysvm_access_required into find_mapping") and now my static
checker complains that "r" might not be initialized at the end of the
function.  I've reviewed the code, and that seems possible, but it's
also possible I may have missed something.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
index b46280c1279f..2918de2f39ec 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -648,7 +648,7 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx)
 	uint32_t allocated = 0;
 	uint32_t tmp, handle = 0;
 	uint32_t *size = &tmp;
-	int i, r, idx = 0;
+	int i, r = 0, idx = 0;
 
 	p->job->vm = NULL;
 	ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo);

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

* [PATCH 2/2] drm/amdgpu: Potential uninitialized variable in amdgpu_vm_update_directories()
  2017-09-30  8:13 [PATCH 1/2] drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs() Dan Carpenter
@ 2017-09-30  8:14 ` Dan Carpenter
  2017-09-30  8:25 ` [PATCH 1/2] drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs() Christian König
  1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2017-09-30  8:14 UTC (permalink / raw)
  To: Alex Deucher, Christian König
  Cc: kernel-janitors, Felix Kuehling, Harish Kasiviswanathan, amd-gfx,
	dri-devel, Zhang, Jerry

After commit ea09729c9302 ("drm/amdgpu: rework page directory filling
v2") then it becomes a lot harder to verify that "r" is initialized.  My
static checker complains and so I've reviewed the code.  It does look
like it might be buggy... Anyway, it doesn't hurt to set "r" to zero
at the start.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index bbcc67038203..fb3afab55907 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1243,7 +1243,7 @@ static void amdgpu_vm_invalidate_level(struct amdgpu_vm *vm,
 int amdgpu_vm_update_directories(struct amdgpu_device *adev,
 				 struct amdgpu_vm *vm)
 {
-	int r;
+	int r = 0;
 
 	spin_lock(&vm->status_lock);
 	while (!list_empty(&vm->relocated)) {
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 1/2] drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs()
  2017-09-30  8:13 [PATCH 1/2] drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs() Dan Carpenter
  2017-09-30  8:14 ` [PATCH 2/2] drm/amdgpu: Potential uninitialized variable in amdgpu_vm_update_directories() Dan Carpenter
@ 2017-09-30  8:25 ` Christian König
       [not found]   ` <0b5a4cef-085d-bbeb-e673-79f8163a2e34-5C7GfCeVMHo@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Christian König @ 2017-09-30  8:25 UTC (permalink / raw)
  To: Dan Carpenter, Alex Deucher
  Cc: David Airlie, Frank Min, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Chris Wilson,
	Xiangliang Yu, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Junwei Zhang, Leo Liu

Am 30.09.2017 um 10:13 schrieb Dan Carpenter:
> We shifted some code around in commit 9cca0b8e5df0 ("drm/amdgpu: move
> amdgpu_cs_sysvm_access_required into find_mapping") and now my static
> checker complains that "r" might not be initialized at the end of the
> function.  I've reviewed the code, and that seems possible, but it's
> also possible I may have missed something.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Good catches, Reviewed-by: Christian König <christian.koenig@amd.com> 
for both patches.

>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> index b46280c1279f..2918de2f39ec 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> @@ -648,7 +648,7 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx)
>   	uint32_t allocated = 0;
>   	uint32_t tmp, handle = 0;
>   	uint32_t *size = &tmp;
> -	int i, r, idx = 0;
> +	int i, r = 0, idx = 0;
>   
>   	p->job->vm = NULL;
>   	ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo);


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

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

* Re: [PATCH 1/2] drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs()
       [not found]   ` <0b5a4cef-085d-bbeb-e673-79f8163a2e34-5C7GfCeVMHo@public.gmane.org>
@ 2017-11-08 19:53     ` Ernst Sjöstrand
  2017-11-08 20:37       ` Alex Deucher
  0 siblings, 1 reply; 5+ messages in thread
From: Ernst Sjöstrand @ 2017-11-08 19:53 UTC (permalink / raw)
  To: Christian König
  Cc: David Airlie, Leo Liu, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	amd-gfx mailing list, Chris Wilson, Junwei Zhang, Xiangliang Yu,
	Maling list - DRI developers, Alex Deucher, Frank Min,
	Dan Carpenter

Can't find these anywhere yet, errors still there.

https://patchwork.freedesktop.org/series/31220/

Regards
//Ernst

2017-09-30 10:25 GMT+02:00 Christian König <christian.koenig@amd.com>:
> Am 30.09.2017 um 10:13 schrieb Dan Carpenter:
>>
>> We shifted some code around in commit 9cca0b8e5df0 ("drm/amdgpu: move
>> amdgpu_cs_sysvm_access_required into find_mapping") and now my static
>> checker complains that "r" might not be initialized at the end of the
>> function.  I've reviewed the code, and that seems possible, but it's
>> also possible I may have missed something.
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>
> Good catches, Reviewed-by: Christian König <christian.koenig@amd.com> for
> both patches.
>
>
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> index b46280c1279f..2918de2f39ec 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>> @@ -648,7 +648,7 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser
>> *p, uint32_t ib_idx)
>>         uint32_t allocated = 0;
>>         uint32_t tmp, handle = 0;
>>         uint32_t *size = &tmp;
>> -       int i, r, idx = 0;
>> +       int i, r = 0, idx = 0;
>>         p->job->vm = NULL;
>>         ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo);
>
>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH 1/2] drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs()
  2017-11-08 19:53     ` Ernst Sjöstrand
@ 2017-11-08 20:37       ` Alex Deucher
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2017-11-08 20:37 UTC (permalink / raw)
  To: Ernst Sjöstrand
  Cc: Christian König, David Airlie, Leo Liu, kernel-janitors,
	amd-gfx mailing list, Chris Wilson, Junwei Zhang, Xiangliang Yu,
	Maling list - DRI developers, Alex Deucher, Frank Min,
	Dan Carpenter

On Wed, Nov 8, 2017 at 2:53 PM, Ernst Sjöstrand <ernstp@gmail.com> wrote:
> Can't find these anywhere yet, errors still there.
>
> https://patchwork.freedesktop.org/series/31220/

Applied.  thanks for the reminder.

Alex

>
> Regards
> //Ernst
>
> 2017-09-30 10:25 GMT+02:00 Christian König <christian.koenig@amd.com>:
>> Am 30.09.2017 um 10:13 schrieb Dan Carpenter:
>>>
>>> We shifted some code around in commit 9cca0b8e5df0 ("drm/amdgpu: move
>>> amdgpu_cs_sysvm_access_required into find_mapping") and now my static
>>> checker complains that "r" might not be initialized at the end of the
>>> function.  I've reviewed the code, and that seems possible, but it's
>>> also possible I may have missed something.
>>>
>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>
>>
>> Good catches, Reviewed-by: Christian König <christian.koenig@amd.com> for
>> both patches.
>>
>>
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>>> index b46280c1279f..2918de2f39ec 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
>>> @@ -648,7 +648,7 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser
>>> *p, uint32_t ib_idx)
>>>         uint32_t allocated = 0;
>>>         uint32_t tmp, handle = 0;
>>>         uint32_t *size = &tmp;
>>> -       int i, r, idx = 0;
>>> +       int i, r = 0, idx = 0;
>>>         p->job->vm = NULL;
>>>         ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo);
>>
>>
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2017-11-08 20:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-30  8:13 [PATCH 1/2] drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs() Dan Carpenter
2017-09-30  8:14 ` [PATCH 2/2] drm/amdgpu: Potential uninitialized variable in amdgpu_vm_update_directories() Dan Carpenter
2017-09-30  8:25 ` [PATCH 1/2] drm/amdgpu: potential uninitialized variable in amdgpu_vce_ring_parse_cs() Christian König
     [not found]   ` <0b5a4cef-085d-bbeb-e673-79f8163a2e34-5C7GfCeVMHo@public.gmane.org>
2017-11-08 19:53     ` Ernst Sjöstrand
2017-11-08 20:37       ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox