diff mbox series

[RFC,1/2] drm/i915: Fix NULL pointer dereference in execlists' trace_ports()

Message ID 20190806122458.15237-2-janusz.krzysztofik@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Fix panic if nothing to promote after preempt on reset | expand

Commit Message

Janusz Krzysztofik Aug. 6, 2019, 12:24 p.m. UTC
If it ever happens trace_port() helper is called with NULL port 0,
kernel panic occurs.  Fix it.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
index d9061d9348cb..aa138aaf8743 100644
--- a/drivers/gpu/drm/i915/gt/intel_lrc.c
+++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
@@ -656,10 +656,10 @@  trace_ports(const struct intel_engine_execlists *execlists,
 
 	GEM_TRACE("%s: %s { %llx:%lld%s, %llx:%lld }\n",
 		  engine->name, msg,
-		  ports[0]->fence.context,
-		  ports[0]->fence.seqno,
-		  i915_request_completed(ports[0]) ? "!" :
-		  i915_request_started(ports[0]) ? "*" :
+		  ports[0] ? ports[0]->fence.context : 0,
+		  ports[0] ? ports[0]->fence.seqno : 0,
+		  ports[0] && i915_request_completed(ports[0]) ? "!" :
+		  ports[0] && i915_request_started(ports[0]) ? "*" :
 		  "",
 		  ports[1] ? ports[1]->fence.context : 0,
 		  ports[1] ? ports[1]->fence.seqno : 0);