From: Pierre Moreau Date: Sat, 18 Feb 2017 17:51:50 +0000 (+0100) Subject: nv50/ir: check for origin insn in findOriginForTestWithZero X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=655c395f65b79bc05259d3ee4887f147d94b243c;p=mesa.git 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 Reviewed-by: Ilia Mirkin --- diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp index 79403c93dfd..d358abc5bd7 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();