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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/gt/intel_lrc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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);
-- 
2.21.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux