Skip to content

Commit

Permalink
nir/validate: assume() that hashtable entry exists
Browse files Browse the repository at this point in the history
At this point, it would require a logic error in nir_validate to not
have already populated this hashtable entry, but coverity doesn't
realize that:

CID 1265547 (#1 of 1): Dereference null return value (NULL_RETURNS)3.
dereference: Dereferencing a null pointer entry.

CID 1271039 (#1 of 1): Dereference null return value (NULL_RETURNS)3.
dereference: Dereferencing a null pointer entry.

Signed-off-by: Rob Clark <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
  • Loading branch information
freedreno-zz committed May 20, 2016
1 parent fcd6b3f commit df361fc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/compiler/nir/nir_validate.c
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ postvalidate_reg_decl(nir_register *reg, validate_state *state)
{
struct hash_entry *entry = _mesa_hash_table_search(state->regs, reg);

assume(entry);
reg_validate_state *reg_state = (reg_validate_state *) entry->data;

nir_foreach_use(src, reg) {
Expand Down Expand Up @@ -955,6 +956,8 @@ postvalidate_ssa_def(nir_ssa_def *def, void *void_state)
validate_state *state = void_state;

struct hash_entry *entry = _mesa_hash_table_search(state->ssa_defs, def);

assume(entry);
ssa_def_validate_state *def_state = (ssa_def_validate_state *)entry->data;

nir_foreach_use(src, def) {
Expand Down

0 comments on commit df361fc

Please sign in to comment.