gallivm/draw: calloc prim id toavoid undef
authorDave Airlie <airlied@redhat.com>
Wed, 8 Apr 2020 05:43:47 +0000 (15:43 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 15 Apr 2020 04:26:11 +0000 (14:26 +1000)
Otherwise masked off channels can access random bad memory

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4560>

src/gallium/auxiliary/draw/draw_gs.c

index 9cfec4dcf114244afb7d8c20e831bccfc2546b96..0cbead3f9acd6e2bd12889c1e2ea28d4721970d9 100644 (file)
@@ -880,7 +880,7 @@ draw_create_geometry_shader(struct draw_context *draw,
 
       gs->llvm_emitted_primitives = align_malloc(vector_size * PIPE_MAX_VERTEX_STREAMS, vector_size);
       gs->llvm_emitted_vertices = align_malloc(vector_size * PIPE_MAX_VERTEX_STREAMS, vector_size);
-      gs->llvm_prim_ids = align_malloc(vector_size, vector_size);
+      gs->llvm_prim_ids = align_calloc(vector_size, vector_size);
 
       gs->fetch_outputs = llvm_fetch_gs_outputs;
       gs->fetch_inputs = llvm_fetch_gs_input;