Mesa (master): r600/llvm: initialize radeon_llvm_binary

Tom Stellard tstellar at kemper.freedesktop.org
Fri Nov 15 17:55:21 UTC 2013


Module: Mesa
Branch: master
Commit: dd73b99420de17651001e0a4d937f1f66fbef14c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dd73b99420de17651001e0a4d937f1f66fbef14c

Author: Aaron Watry <awatry at gmail.com>
Date:   Thu Nov 14 12:17:42 2013 -0600

r600/llvm: initialize radeon_llvm_binary

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 at amd.com>

v2: Fix indentation

CC: "10.0" <mesa-stable at lists.freedesktop.org>

---

 src/gallium/drivers/r600/r600_llvm.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
index a2ff0ec..f6784eb 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -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);




More information about the mesa-commit mailing list