From: Ian Romanick Date: Mon, 15 Jul 2019 22:18:47 +0000 (-0700) Subject: nir/search: Fix possible NULL dereference in is_fsign X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=050e4e28bf7c86e2fc78b9e4dbaf285db1ed4b43;p=mesa.git nir/search: Fix possible NULL dereference in is_fsign Reviewed-by: Caio Marcelo de Oliveira Filho Fixes: 09705747d72 ("nir/algebraic: Reassociate fadd into fmul in DPH-like pattern") --- diff --git a/src/compiler/nir/nir_search_helpers.h b/src/compiler/nir/nir_search_helpers.h index a52104c7109..90ba897742d 100644 --- a/src/compiler/nir/nir_search_helpers.h +++ b/src/compiler/nir/nir_search_helpers.h @@ -209,7 +209,7 @@ is_fsign(nir_alu_instr *instr, unsigned src, if (src_alu->op == nir_op_fneg) src_alu = nir_src_as_alu_instr(src_alu->src[0].src); - return src_alu->op == nir_op_fsign; + return src_alu != NULL && src_alu->op == nir_op_fsign; } static inline bool