summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Janes <[email protected]>2016-05-13 13:04:56 -0700
committerMark Janes <[email protected]>2016-05-16 11:11:11 -0700
commitfd854c1add853eb3363d735da2faca9c9c092e4c (patch)
tree5b8a18ef25f44aef1bcb21059126b1f4797a49b1
parentbf91034d44a992b1e5a5aa49a3d3a6740be5b453 (diff)
i965: check tcs for NULL dereference
Coverity issue 1361544 found an instance where the tcs variable is checked for NULL, but unconditionally dereferenced later in the same function. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_tcs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index e8178c6daab..9589fa5edeb 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -278,14 +278,16 @@ brw_codegen_tcs_prog(struct brw_context *brw,
if (unlikely(brw->perf_debug)) {
struct brw_shader *btcs = (struct brw_shader *) tcs;
- if (btcs->compiled_once) {
- brw_tcs_debug_recompile(brw, shader_prog, key);
+ if (btcs) {
+ if (btcs->compiled_once) {
+ brw_tcs_debug_recompile(brw, shader_prog, key);
+ }
+ btcs->compiled_once = true;
}
if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) {
perf_debug("TCS compile took %.03f ms and stalled the GPU\n",
(get_time() - start_time) * 1000);
}
- btcs->compiled_once = true;
}
/* Scratch space is used for register spilling */