r600/llvm: initialize radeon_llvm_binary
authorAaron Watry <awatry@gmail.com>
Thu, 14 Nov 2013 18:17:42 +0000 (12:17 -0600)
committerTom Stellard <thomas.stellard@amd.com>
Fri, 15 Nov 2013 17:53:31 +0000 (09:53 -0800)
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.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
v2: Fix indentation

CC: "10.0" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/r600/r600_llvm.c

index a2ff0ec237da9a414dc82f0f80aebc0e26a5400c..f6784ebd1487594ffd8d71257967328d56dbde77 100644 (file)
@@ -831,6 +831,7 @@ unsigned r600_llvm_compile(
        const char * gpu_family = r600_llvm_gpu_string(family);
        unsigned i;
 
+       memset(&binary, 0, sizeof(struct radeon_llvm_binary));
        r = radeon_llvm_compile(mod, &binary, gpu_family, dump);
 
        assert(binary.code_size % 4 == 0);