From: Tapani Pälli Date: Tue, 18 Aug 2020 12:16:37 +0000 (+0300) Subject: anv: null check for buffer before reading size X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=709dffa856682b706e516dd324e2f5129a127e8e;p=mesa.git anv: null check for buffer before reading size v2: move assignment under existing check (Nanley) Fixes: b9a05447a19 ("anv: dynamic vertex input binding stride and size support") Signed-off-by: Tapani Pälli Reviewed-by: Nanley Chery Part-of: --- diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 7afaeca366b..4522f5d2aef 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -3344,13 +3344,13 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer) bool dynamic_stride = cmd_buffer->state.gfx.dynamic.dyn_vbo_stride; bool dynamic_size = cmd_buffer->state.gfx.dynamic.dyn_vbo_size; - uint32_t stride = dynamic_stride ? - cmd_buffer->state.vertex_bindings[vb].stride : pipeline->vb[vb].stride; - uint32_t size = dynamic_size ? - cmd_buffer->state.vertex_bindings[vb].size : buffer->size; - struct GENX(VERTEX_BUFFER_STATE) state; if (buffer) { + uint32_t stride = dynamic_stride ? + cmd_buffer->state.vertex_bindings[vb].stride : pipeline->vb[vb].stride; + uint32_t size = dynamic_size ? + cmd_buffer->state.vertex_bindings[vb].size : buffer->size; + state = (struct GENX(VERTEX_BUFFER_STATE)) { .VertexBufferIndex = vb,