panfrost: Fix crash in compute variant allocation
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 20 Jan 2020 21:01:53 +0000 (16:01 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 22 Jan 2020 13:48:24 +0000 (13:48 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: d8a3501f1b2 ("panfrost: Dynamically allocate shader variants")
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3515>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3515>

src/gallium/drivers/panfrost/pan_compute.c

index 905e6e234e0f9f69156f7e452e69bc0f498b3723..9e3306b673f190069681193f4fecf69b6618538c 100644 (file)
@@ -46,7 +46,8 @@ panfrost_create_compute_state(
         so->cbase = *cso;
         so->is_compute = true;
 
-        struct panfrost_shader_state *v = &so->variants[0];
+        struct panfrost_shader_state *v = calloc(1, sizeof(*v));
+        so->variants = v;
 
         so->variant_count = 1;
         so->active_variant = 0;