[PATCH] drm/i915: Allow NULL memory region

Tvrtko Ursulin tursulin at ursulin.net
Thu Jul 25 07:48:35 UTC 2024


Hi,

On 12/07/2024 22:41, Jonathan Cavitt wrote:
> Prevent a NULL pointer access in intel_memory_regions_hw_probe.

For future reference please include some impact assessment in patches 
tagged as fixes. Makes maintainers job, and even anyone's who tries to 
backport stuff to stable at some future date, much easier if it is known 
how important is the fix and in what circumstances can the problem it is 
fixing trigger.

Regards,

Tvrtko

> Fixes: 05da7d9f717b ("drm/i915/gem: Downgrade stolen lmem setup warning")
> Reported-by: Dan Carpenter <dan.carpenter at linaro.org>
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
> ---
>   drivers/gpu/drm/i915/intel_memory_region.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_memory_region.c b/drivers/gpu/drm/i915/intel_memory_region.c
> index 172dfa7c3588b..d40ee1b42110a 100644
> --- a/drivers/gpu/drm/i915/intel_memory_region.c
> +++ b/drivers/gpu/drm/i915/intel_memory_region.c
> @@ -368,8 +368,10 @@ int intel_memory_regions_hw_probe(struct drm_i915_private *i915)
>   			goto out_cleanup;
>   		}
>   
> -		mem->id = i;
> -		i915->mm.regions[i] = mem;
> +		if (mem) { /* Skip on non-fatal errors */
> +			mem->id = i;
> +			i915->mm.regions[i] = mem;
> +		}
>   	}
>   
>   	for (i = 0; i < ARRAY_SIZE(i915->mm.regions); i++) {


More information about the Intel-gfx mailing list