[Mesa-dev] [PATCH 1/3] r600/llvm: initialize radeon_llvm_binary

Tom Stellard tom at stellard.net
Mon Nov 11 15:40:52 PST 2013


On Thu, Nov 07, 2013 at 06:08:14PM -0600, Aaron Watry wrote:
> use memset to initialize to 0's... otherwise code_size and config_size could be uninitialized when read later in this method. It's also hard to do NULL checks on uninitialized pointers.
> ---
>  src/gallium/drivers/r600/r600_llvm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
> index 5afe3cb..f52ae84 100644
> --- a/src/gallium/drivers/r600/r600_llvm.c
> +++ b/src/gallium/drivers/r600/r600_llvm.c
> @@ -712,6 +712,7 @@ unsigned r600_llvm_compile(
>  	const char * gpu_family = r600_llvm_gpu_string(family);
>  	unsigned i;
>  
> +    memset(&binary, 0, sizeof(struct radeon_llvm_binary));

The indentation looks wrong here, otherwise this patch is:

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>

>  	r = radeon_llvm_compile(mod, &binary, gpu_family, dump);
>  
>  	assert(binary.code_size % 4 == 0);
> -- 
> 1.8.3.2
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list