Mesa (staging/19.2): nir/search: Fix possible NULL dereference in is_fsign

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 18 17:02:55 UTC 2019


Module: Mesa
Branch: staging/19.2
Commit: e958b35a40ff8f8c26d1890c53016df3061f65fc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e958b35a40ff8f8c26d1890c53016df3061f65fc

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Jul 15 15:18:47 2019 -0700

nir/search: Fix possible NULL dereference in is_fsign

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Fixes: 09705747d72 ("nir/algebraic: Reassociate fadd into fmul in DPH-like pattern")
(cherry picked from commit 050e4e28bf7c86e2fc78b9e4dbaf285db1ed4b43)

---

 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 e2a436be6b7..7305e47aebb 100644
--- a/src/compiler/nir/nir_search_helpers.h
+++ b/src/compiler/nir/nir_search_helpers.h
@@ -203,7 +203,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




More information about the mesa-commit mailing list