Commit 55820e1e authored by Damien Lespiau's avatar Damien Lespiau Committed by Daniel Vetter

drm/i915: Don't overrun the intel_wa_regs array

When entering intel_ring_emit_wa() with num_wa_regs equal to
I915_MAX_WA_REGS, we end up indexing the intel_wa_regs array beyond its
allocation.

Fix the check then.
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
Reviewed-by: default avatarArun Siluvery <arun.siluvery@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 1ed1ef9d
......@@ -663,7 +663,7 @@ static inline void intel_ring_emit_wa(struct intel_engine_cs *ring,
struct drm_device *dev = ring->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
if (dev_priv->num_wa_regs > I915_MAX_WA_REGS)
if (dev_priv->num_wa_regs >= I915_MAX_WA_REGS)
return;
intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment