From 050e4e28bf7c86e2fc78b9e4dbaf285db1ed4b43 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 15 Jul 2019 15:18:47 -0700 Subject: [PATCH] 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") --- src/compiler/nir/nir_search_helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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