[Intel-gfx] [PATCH 11/13] drm/i915: Avoid overflowing the DP link rate arrays
ville.syrjala at linux.intel.com
ville.syrjala at linux.intel.com
Thu Mar 12 08:10:37 PDT 2015
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Complain loudly if we ever attempt to overflow the the supported_rates[]
array. This should never happen since the sink_rates[] array will always
be smaller or of equal size. But should someone change that we want to
catch it without scribblign over the stack.
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/i915/intel_dp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 52376fd..a088186 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1200,6 +1200,8 @@ static int intersect_rates(const int *source_rates, int source_len,
while (i < source_len && j < sink_len) {
if (source_rates[i] == sink_rates[j]) {
+ if (WARN_ON(k >= DP_MAX_SUPPORTED_RATES))
+ return k;
supported_rates[k] = source_rates[i];
++k;
++i;
--
2.0.5
More information about the Intel-gfx
mailing list