[Intel-gfx] [PATCH 1/4] drm/i915: Fix for potential NULL pointer dereference at ctx access.

Namrta Salonie namrta.salonie at intel.com
Thu Nov 19 03:27:28 PST 2015


    Added a null check for the context pointer, before de-referencing it.
    Found by static analysis tool.

Signed-off-by: Namrta Salonie <namrta.salonie at intel.com>
---
 drivers/gpu/drm/i915/i915_gpu_error.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 2f04e4f..29ecd0c 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1036,7 +1036,7 @@ static void i915_gem_record_rings(struct drm_device *dev,
 			 * for it to be useful (e.g. dump the context being
 			 * executed).
 			 */
-			if (request)
+			if (request && request->ctx)
 				rbuf = request->ctx->engine[ring->id].ringbuf;
 			else
 				rbuf = ring->default_context->engine[ring->id].ringbuf;
-- 
1.7.9.5



More information about the Intel-gfx mailing list