vc4: check instruction before setting flags

This fixes an issue detected by static analyzer: access to field 'sf'
results in a dereference of a null pointer (loaded from variable
'last_inst').

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34050>
This commit is contained in:
Juan A. Suarez Romero 2025-01-10 14:12:45 +01:00 committed by Marge Bot
parent 72bc74f0be
commit 2c8411e9d2

View file

@ -809,7 +809,9 @@ qir_SF(struct vc4_compile *c, struct qreg src)
last_inst != c->defs[src.index]) {
last_inst = qir_MOV_dest(c, qir_reg(QFILE_NULL, 0), src);
}
last_inst->sf = true;
if (last_inst)
last_inst->sf = true;
}
#define OPTPASS(func) \