[PATCH] drm/i915: Fix possible null pointer dereference after drm_dbg_printer conversion

Rodrigo Vivi rodrigo.vivi at intel.com
Mon Feb 19 20:02:55 UTC 2024


On Mon, Feb 19, 2024 at 01:14:23PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> 
> Request can be NULL if no guilty request was identified so simply use
> engine->i915 instead.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> Fixes: d50892a9554c ("drm/i915: switch from drm_debug_printer() to device specific drm_dbg_printer()")
> Reported-by: Dan Carpenter <dan.carpenter at linaro.org>
> Cc: Jani Nikula <jani.nikula at intel.com>
> Cc: Luca Coelho <luciano.coelho at intel.com>
> Cc: Maxime Ripard <mripard at kernel.org>
> Cc: Jani Nikula <jani.nikula at linux.intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>

> ---
>  drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
> index 5f8d86e25993..8d4bb95f8424 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c
> @@ -96,8 +96,8 @@ static void heartbeat_commit(struct i915_request *rq,
>  static void show_heartbeat(const struct i915_request *rq,
>  			   struct intel_engine_cs *engine)
>  {
> -	struct drm_printer p = drm_dbg_printer(&rq->i915->drm, DRM_UT_DRIVER,
> -					       "heartbeat");
> +	struct drm_printer p =
> +		drm_dbg_printer(&engine->i915->drm, DRM_UT_DRIVER, "heartbeat");
>  
>  	if (!rq) {
>  		intel_engine_dump(engine, &p,
> -- 
> 2.40.1
> 


More information about the Intel-gfx mailing list