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

Author: Vinson Lee <v...@freedesktop.org>
Date:   Mon Aug 19 00:43:09 2013 -0700

r600g/sb: Move memsets of member structs to within constructor bodies.

Silences "Uninitialized pointer field" defects reported by Coverity.

Signed-off-by: Vinson Lee <v...@freedesktop.org>
Reviewed-by: Vadim Girlin <vadimgir...@gmail.com>

---

 src/gallium/drivers/r600/sb/sb_ir.h       |    6 +++---
 src/gallium/drivers/r600/sb/sb_shader.cpp |    3 ---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/r600/sb/sb_ir.h 
b/src/gallium/drivers/r600/sb/sb_ir.h
index c838f62..a74d6cb 100644
--- a/src/gallium/drivers/r600/sb/sb_ir.h
+++ b/src/gallium/drivers/r600/sb/sb_ir.h
@@ -963,7 +963,7 @@ public:
 class cf_node : public container_node {
 protected:
        cf_node() : container_node(NT_OP, NST_CF_INST), jump_target(),
-               jump_after_target() {};
+               jump_after_target() { memset(&bc, 0, sizeof(bc_cf)); };
 public:
        bc_cf bc;
 
@@ -982,7 +982,7 @@ public:
 
 class alu_node : public node {
 protected:
-       alu_node() : node(NT_OP, NST_ALU_INST) {};
+       alu_node() : node(NT_OP, NST_ALU_INST) { memset(&bc, 0, 
sizeof(bc_alu)); };
 public:
        bc_alu bc;
 
@@ -1028,7 +1028,7 @@ public:
 
 class fetch_node : public node {
 protected:
-       fetch_node() : node(NT_OP, NST_FETCH_INST) {};
+       fetch_node() : node(NT_OP, NST_FETCH_INST) { memset(&bc, 0, 
sizeof(bc_fetch)); };
 public:
        bc_fetch bc;
 
diff --git a/src/gallium/drivers/r600/sb/sb_shader.cpp 
b/src/gallium/drivers/r600/sb/sb_shader.cpp
index 9fc47ae..98e52b1 100644
--- a/src/gallium/drivers/r600/sb/sb_shader.cpp
+++ b/src/gallium/drivers/r600/sb/sb_shader.cpp
@@ -260,7 +260,6 @@ node* shader::create_node(node_type nt, node_subtype nst, 
node_flags flags) {
 
 alu_node* shader::create_alu() {
        alu_node* n = new (pool.allocate(sizeof(alu_node))) alu_node();
-       memset(&n->bc, 0, sizeof(bc_alu));
        all_nodes.push_back(n);
        return n;
 }
@@ -281,7 +280,6 @@ alu_packed_node* shader::create_alu_packed() {
 
 cf_node* shader::create_cf() {
        cf_node* n = new (pool.allocate(sizeof(cf_node))) cf_node();
-       memset(&n->bc, 0, sizeof(bc_cf));
        n->bc.barrier = 1;
        all_nodes.push_back(n);
        return n;
@@ -289,7 +287,6 @@ cf_node* shader::create_cf() {
 
 fetch_node* shader::create_fetch() {
        fetch_node* n = new (pool.allocate(sizeof(fetch_node))) fetch_node();
-       memset(&n->bc, 0, sizeof(bc_fetch));
        all_nodes.push_back(n);
        return n;
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to