dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Avoid possibly uninitialized variable
@ 2015-08-14 11:52 Thierry Reding
  2015-08-14 12:35 ` Christian König
  0 siblings, 1 reply; 2+ messages in thread
From: Thierry Reding @ 2015-08-14 11:52 UTC (permalink / raw)
  To: Christian König, Alex Deucher; +Cc: Boyuan Zhang, dri-devel

From: Thierry Reding <treding@nvidia.com>

The min_ctx_size is only initialized for H265, so garbage will end up in
buf_sizes[4] for all other stream types. Better initialize the value to
0 to avoid unpleasant surprises.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index f5c22556ec2c..91e79c3f2403 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -374,7 +374,7 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[])
 	unsigned height_in_mb = ALIGN(height / 16, 2);
 	unsigned fs_in_mb = width_in_mb * height_in_mb;
 
-	unsigned image_size, tmp, min_dpb_size, num_dpb_buffer, min_ctx_size;
+	unsigned image_size, tmp, min_dpb_size, num_dpb_buffer, min_ctx_size = 0;
 
 	image_size = width * height;
 	image_size += image_size / 2;
-- 
2.4.5

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

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

* Re: [PATCH] drm/amdgpu: Avoid possibly uninitialized variable
  2015-08-14 11:52 [PATCH] drm/amdgpu: Avoid possibly uninitialized variable Thierry Reding
@ 2015-08-14 12:35 ` Christian König
  0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2015-08-14 12:35 UTC (permalink / raw)
  To: Thierry Reding, Christian König, Alex Deucher
  Cc: Boyuan Zhang, dri-devel

On 14.08.2015 13:52, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> The min_ctx_size is only initialized for H265, so garbage will end up in
> buf_sizes[4] for all other stream types. Better initialize the value to
> 0 to avoid unpleasant surprises.
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>

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

We already stumbled over this internally as well, not sure if Alex is 
going to merge your patch or the internal version.

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index f5c22556ec2c..91e79c3f2403 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -374,7 +374,7 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[])
>   	unsigned height_in_mb = ALIGN(height / 16, 2);
>   	unsigned fs_in_mb = width_in_mb * height_in_mb;
>   
> -	unsigned image_size, tmp, min_dpb_size, num_dpb_buffer, min_ctx_size;
> +	unsigned image_size, tmp, min_dpb_size, num_dpb_buffer, min_ctx_size = 0;
>   
>   	image_size = width * height;
>   	image_size += image_size / 2;

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

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

end of thread, other threads:[~2015-08-14 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-14 11:52 [PATCH] drm/amdgpu: Avoid possibly uninitialized variable Thierry Reding
2015-08-14 12:35 ` Christian König

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