]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/pmu: Fix enable count array size and bounds checking
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Tue, 5 Feb 2019 13:03:53 +0000 (13:03 +0000)
committerJani Nikula <jani.nikula@intel.com>
Tue, 12 Feb 2019 13:37:24 +0000 (15:37 +0200)
commit0694bf3746e196b119f1cf41268f5a1df03fdec6
treee67fac840044e7fb019fccd922c4a0af1582cdd2
parentcbea3c90894ae03808ad96144d6a583ca4175e19
drm/i915/pmu: Fix enable count array size and bounds checking

Enable count array is supposed to have one counter for each possible
engine sampler. As such, array sizing and bounds checking is not correct
and would blow up the asserts if more samplers were added.

No ill-effect in the current code base but lets fix it for correctness.

At the same time tidy the assert for readability and robustness.

v2:
 * One check per assert. (Chris Wilson)

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Fixes: bd9e8816844c ("drm/i915/pmu: Expose a PMU interface for perf queries")
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190205130353.21105-1-tvrtko.ursulin@linux.intel.com
(cherry picked from commit 26a11deea685b41a43edb513194718aa1f461c9a)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/i915_pmu.c
drivers/gpu/drm/i915/i915_pmu.h
drivers/gpu/drm/i915/intel_ringbuffer.h