drm/amdgpu: Avoid possibly uninitialized variable
Subsystems (2)
PATCH 1/1 drm/amdgpu: Avoid possibly uninitialized variable
From: Thierry Reding <[email protected]>
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1 -1
@@ -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 ;
Signature · 6 lines
2.4.5 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The
min_ctx_sizeis 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 <[email protected]>
We already stumbled over this internally as well, not sure if Alex is going to merge your patch or the internal version.
Regards,
Christian.
Quoted 9 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) · line 380
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +1
-1@@ -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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel