diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-02-13 17:12:51 -0500 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2020-02-16 09:16:50 -0500 |
commit | 6af14d3685fac433193b92f9ad6c9f8a3eaf87ff (patch) | |
tree | 184c55d14fcf0cd6389cc54c8cded8599276809d /src/panfrost/midgard | |
parent | 5c06ecd2c64a36496f7a0a1d2811d8a90b1a0620 (diff) |
pan/midgard: Don't crash with constants on unknown ops
Just use a dummy name instead.. we can't know a priori what type an
unknown op will consume, but we don't want to dereference a null
pointer.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Fixes: 24360966ab3 ("panfrost/midgard: Prettify embedded constant
prints")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3835>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r-- | src/panfrost/midgard/midgard_print.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/panfrost/midgard/midgard_print.c b/src/panfrost/midgard/midgard_print.c index 85a1d981722..94a0f1a6453 100644 --- a/src/panfrost/midgard/midgard_print.c +++ b/src/panfrost/midgard/midgard_print.c @@ -110,6 +110,10 @@ mir_print_constant_component(FILE *fp, const midgard_constants *consts, unsigned bool is_sint = false, is_uint = false, is_hex = false; const char *opname = alu_opcode_props[op].name; + /* Add a sentinel name to prevent crashing */ + if (!opname) + opname = "unknown"; + if (opname[0] == 'u') { /* If the opcode starts with a 'u' we are sure we deal with an * unsigned int operation |