nir/validate: fix null deref coverity warning
authorRob Clark <robclark@freedesktop.org>
Wed, 18 May 2016 15:40:34 +0000 (11:40 -0400)
committerRob Clark <robclark@freedesktop.org>
Mon, 23 May 2016 14:14:50 +0000 (10:14 -0400)
CID 1265536 (#1 of 2): Explicit null dereferenced (FORWARD_NULL)6.
var_deref_op: Dereferencing null pointer parent.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_validate.c

index 8ac55d5e5bcc3bdc6134340eee9f6caffe390127..35bb162ac7f9c84fc53f6b0edbf5b8d93e2e5e09 100644 (file)
@@ -376,6 +376,7 @@ validate_deref_chain(nir_deref *deref, validate_state *state)
          break;
 
       case nir_deref_type_struct:
+         assume(parent); /* cannot happen: deref change starts w/ nir_deref_var */
          validate_assert(state, deref->type ==
                 glsl_get_struct_field(parent->type,
                                       nir_deref_as_struct(deref)->index));