Commit e6bda3e4 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Daniel Vetter

drm/i915: Avoid overflowing the DP link rate arrays

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: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarSonika Jindal <sonika.jindal@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent ed4e9c1d
...@@ -1203,6 +1203,8 @@ static int intersect_rates(const int *source_rates, int source_len, ...@@ -1203,6 +1203,8 @@ static int intersect_rates(const int *source_rates, int source_len,
while (i < source_len && j < sink_len) { while (i < source_len && j < sink_len) {
if (source_rates[i] == sink_rates[j]) { if (source_rates[i] == sink_rates[j]) {
if (WARN_ON(k >= DP_MAX_SUPPORTED_RATES))
return k;
supported_rates[k] = source_rates[i]; supported_rates[k] = source_rates[i];
++k; ++k;
++i; ++i;
......
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