summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorJulien Isorce <[email protected]>2017-03-16 13:09:21 +0000
committerJulien Isorce <[email protected]>2017-03-20 18:01:51 +0000
commita6e212440278df2bb0766a5cf745935d94809144 (patch)
treea7f198b75e4071a1e9dc94e3fcffe729a9083724 /src/gallium/drivers
parent521860b2a92bab6394546e6af8709c07e2292033 (diff)
si_descriptor: move velems nullity check before dereference
CID 1399479: Dereference before null check (REVERSE_INULL) check_after_deref: Null-checking velems suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Signed-off-by: Julien Isorce <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/radeonsi/si_descriptors.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index eb79578b347..2e62725e9ca 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -949,15 +949,22 @@ bool si_upload_vertex_buffer_descriptors(struct si_context *sctx)
{
struct si_vertex_element *velems = sctx->vertex_elements;
struct si_descriptors *desc = &sctx->vertex_buffers;
- unsigned i, count = velems->count;
- unsigned desc_list_byte_size = velems->desc_list_byte_size;
+ unsigned i, count;
+ unsigned desc_list_byte_size;
+ unsigned first_vb_use_mask;
uint64_t va;
uint32_t *ptr;
- if (!sctx->vertex_buffers_dirty || !count || !velems)
+ if (!sctx->vertex_buffers_dirty || !velems)
return true;
- unsigned first_vb_use_mask = velems->first_vb_use_mask;
+ count = velems->count;
+
+ if (!count)
+ return true;
+
+ desc_list_byte_size = velems->desc_list_byte_size;
+ first_vb_use_mask = velems->first_vb_use_mask;
/* Vertex buffer descriptors are the only ones which are uploaded
* directly through a staging buffer and don't go through