MAX_ENGINE_CLASS is the highest valid engine class value (COMPUTE_CLASS
== 5), not the number of classes. reset_engine_count[] was sized with
MAX_ENGINE_CLASS entries, so resetting a CCS engine incremented (and
i915_reset_engine_count() read) one element past the end of the array,
aliasing the adjacent field in drm_i915_private (suspend_count).

Size the array as MAX_ENGINE_CLASS + 1, consistent with other per-class
arrays such as intel_gt.engine_class[].

Fixes: cf9cb028ac56 ("drm/i915: Use internal class when counting engine resets")
Cc: <[email protected]>

Assisted-by: LLM
Signed-off-by: Alan Previn <[email protected]>
---
 drivers/gpu/drm/i915/i915_gpu_error.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.h 
b/drivers/gpu/drm/i915/i915_gpu_error.h
index 26970c5e291e..e53139cb77ea 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.h
+++ b/drivers/gpu/drm/i915/i915_gpu_error.h
@@ -225,7 +225,7 @@ struct i915_gpu_error {
        atomic_t reset_count;
 
        /** Number of times an engine has been reset */
-       atomic_t reset_engine_count[MAX_ENGINE_CLASS];
+       atomic_t reset_engine_count[MAX_ENGINE_CLASS + 1];
 };
 
 struct drm_i915_error_state_buf {

base-commit: fbed42265ffde9b162e21ed7ff0cfce070e19aaa
-- 
2.43.0

Reply via email to