Mesa (master): nv50/ir: check for origin insn in findOriginForTestWithZero

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Thu Mar 9 11:43:46 UTC 2017


Module: Mesa
Branch: master
Commit: 655c395f65b79bc05259d3ee4887f147d94b243c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=655c395f65b79bc05259d3ee4887f147d94b243c

Author: Pierre Moreau <pierre.morrow at free.fr>
Date:   Sat Feb 18 18:51:50 2017 +0100

nv50/ir: check for origin insn in findOriginForTestWithZero

Function arguments do not have an "origin" instruction, causing a
NULL-pointer dereference without this check.

Signed-off-by: Pierre Moreau <pierre.morrow at free.fr>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 79403c9..d358abc 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -410,6 +410,8 @@ ConstantFolding::findOriginForTestWithZero(Value *value)
    if (!value)
       return NULL;
    Instruction *insn = value->getInsn();
+   if (!insn)
+      return NULL;
 
    if (insn->asCmp() && insn->op != OP_SLCT)
       return insn->asCmp();




More information about the mesa-commit mailing list