pan/midgard: Check for null consts
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 3 Feb 2020 19:32:22 +0000 (14:32 -0500)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Tue, 4 Feb 2020 07:24:33 +0000 (08:24 +0100)
Valid shaders shouldn't hit this, but Coverity doesn't know that.

CID 1458029:    (FORWARD_NULL)
Passing null pointer "consts" to "print_scalar_field", which dereferences it.

Tomeu: Fix name of variable

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3684>

src/panfrost/midgard/disassemble.c

index 9ef184b8bcede47daa48cebbbfbcf4dfc2e6ade3..a0640d66e8cd27dba40826a20858100aa8812a0e 100644 (file)
@@ -337,6 +337,8 @@ print_scalar_constant(FILE *fp, unsigned src_binary,
         midgard_scalar_alu_src *src = (midgard_scalar_alu_src *)&src_binary;
         unsigned mod = 0;
 
+        assert(consts != NULL);
+
         if (!midgard_is_integer_op(alu->op)) {
                 if (src->abs)
                         mod |= MIDGARD_FLOAT_MOD_ABS;