All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/radeon: fix uninitialized variable
@ 2012-02-28 22:19 Christian König
  2012-02-28 23:23 ` Jerome Glisse
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2012-02-28 22:19 UTC (permalink / raw)
  To: airlied, dri-devel; +Cc: Christian König

Without this fix the driver randomly treats
textures as arrays and I'm really wondering
why gcc isn't complaining about it.

Signed-off-by: Christian König <deathsimple@vodafone.de>
---
 drivers/gpu/drm/radeon/r600_cs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 38ce5d0..387fcc9 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -1304,6 +1304,7 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p,  u32 idx,
 	h0 = G_038004_TEX_HEIGHT(word1) + 1;
 	d0 = G_038004_TEX_DEPTH(word1);
 	nfaces = 1;
+	array = 0;
 	switch (G_038000_DIM(word0)) {
 	case V_038000_SQ_TEX_DIM_1D:
 	case V_038000_SQ_TEX_DIM_2D:
-- 
1.7.5.4

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

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

* Re: [PATCH] drm/radeon: fix uninitialized variable
  2012-02-28 22:19 [PATCH] drm/radeon: fix uninitialized variable Christian König
@ 2012-02-28 23:23 ` Jerome Glisse
  2012-02-29 10:36   ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Jerome Glisse @ 2012-02-28 23:23 UTC (permalink / raw)
  To: Christian König; +Cc: dri-devel

On Tue, 2012-02-28 at 23:19 +0100, Christian König wrote:
> Without this fix the driver randomly treats
> textures as arrays and I'm really wondering
> why gcc isn't complaining about it.
> 
> Signed-off-by: Christian König <deathsimple@vodafone.de>
> ---
>  drivers/gpu/drm/radeon/r600_cs.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
> index 38ce5d0..387fcc9 100644
> --- a/drivers/gpu/drm/radeon/r600_cs.c
> +++ b/drivers/gpu/drm/radeon/r600_cs.c
> @@ -1304,6 +1304,7 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p,  u32 idx,
>  	h0 = G_038004_TEX_HEIGHT(word1) + 1;
>  	d0 = G_038004_TEX_DEPTH(word1);
>  	nfaces = 1;
> +	array = 0;
>  	switch (G_038000_DIM(word0)) {
>  	case V_038000_SQ_TEX_DIM_1D:
>  	case V_038000_SQ_TEX_DIM_2D:

I think if array field are properly initialized this shouldn't be an
issue. But anyway this patch is needed.

Reviewed-by: Jerome Glisse <jglisse@redhat.com>

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

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

* Re: [PATCH] drm/radeon: fix uninitialized variable
  2012-02-28 23:23 ` Jerome Glisse
@ 2012-02-29 10:36   ` Christian König
  0 siblings, 0 replies; 3+ messages in thread
From: Christian König @ 2012-02-29 10:36 UTC (permalink / raw)
  To: Jerome Glisse; +Cc: dri-devel

On 29.02.2012 00:23, Jerome Glisse wrote:
> On Tue, 2012-02-28 at 23:19 +0100, Christian König wrote:
>> Without this fix the driver randomly treats
>> textures as arrays and I'm really wondering
>> why gcc isn't complaining about it.
>>
>> Signed-off-by: Christian König<deathsimple@vodafone.de>
>> ---
>>   drivers/gpu/drm/radeon/r600_cs.c |    1 +
>>   1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
>> index 38ce5d0..387fcc9 100644
>> --- a/drivers/gpu/drm/radeon/r600_cs.c
>> +++ b/drivers/gpu/drm/radeon/r600_cs.c
>> @@ -1304,6 +1304,7 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p,  u32 idx,
>>   	h0 = G_038004_TEX_HEIGHT(word1) + 1;
>>   	d0 = G_038004_TEX_DEPTH(word1);
>>   	nfaces = 1;
>> +	array = 0;
>>   	switch (G_038000_DIM(word0)) {
>>   	case V_038000_SQ_TEX_DIM_1D:
>>   	case V_038000_SQ_TEX_DIM_2D:
> I think if array field are properly initialized this shouldn't be an
> issue. But anyway this patch is needed.
>
> Reviewed-by: Jerome Glisse<jglisse@redhat.com>
Yes indeed, and that is also how I stumbled over this bug. It might be 
problematic for cubemaps, since I don't know how base_array and 
last_array are initialized there.

Anyway, what concerns me more is why gcc isn't complaining about it? 
It's quite obvious that the "if" is depending on an uninitialized value 
here.

Aren't we compiling with "-Wuninitialized" or is it just not work correctly?

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

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

end of thread, other threads:[~2012-02-29 10:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-28 22:19 [PATCH] drm/radeon: fix uninitialized variable Christian König
2012-02-28 23:23 ` Jerome Glisse
2012-02-29 10:36   ` 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.