[Mesa-dev] [PATCH 4/4] radeonsi: silence a Coverity warning

Nicolai Hähnle nhaehnle at gmail.com
Mon May 15 09:18:38 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Coverity doesn't understand that we'll never pass non-NULL for vertex
shaders.

This is a bit lame, actually. A straightforward cross-procedural analysis
limited to this source file should be enough to prove that there's no
NULL-pointer dereference. Oh well.

CID: 1405999
---
 src/gallium/drivers/radeonsi/si_debug.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c
index d08a8fc..d1159ad 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -471,20 +471,22 @@ static void si_dump_descriptors(struct si_context *sctx,
 		sctx->images[processor].enabled_mask,
 	};
 	unsigned required_slots[] = {
 		info ? info->const_buffers_declared : 0,
 		info ? info->shader_buffers_declared : 0,
 		info ? info->samplers_declared : 0,
 		info ? info->images_declared : 0,
 	};
 
 	if (processor == PIPE_SHADER_VERTEX) {
+		assert(info); /* only CS may not have an info struct */
+
 		si_dump_descriptor_list(&sctx->vertex_buffers, shader_name[processor],
 					" - Vertex buffer", info->num_inputs, f);
 	}
 
 	for (unsigned i = 0; i < SI_NUM_SHADER_DESCS; ++i, ++descs)
 		si_dump_descriptor_list(descs, shader_name[processor], elem_name[i],
 					util_last_bit(enabled_slots[i] | required_slots[i]), f);
 }
 
 static void si_dump_gfx_descriptors(struct si_context *sctx,
-- 
2.9.3



More information about the mesa-dev mailing list