1

drm/i915: Allow NULL memory region

Prevent a NULL pointer access in intel_memory_regions_hw_probe.

Fixes: 05da7d9f71 ("drm/i915/gem: Downgrade stolen lmem setup warning")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11704
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240712214156.3969584-1-jonathan.cavitt@intel.com
(cherry picked from commit d75dec1fcb)
Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
This commit is contained in:
Jonathan Cavitt 2024-07-12 14:41:56 -07:00 committed by Tvrtko Ursulin
parent 65564157ae
commit 26720dd2b5

View File

@ -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++) {