Skip to content

Commit

Permalink
drm/i915: Avoid overflowing the DP link rate arrays
Browse files Browse the repository at this point in the history
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@linux.intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Ville Syrjälä authored and Daniel Vetter committed Mar 20, 2015
1 parent ed4e9c1 commit e6bda3e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/i915/intel_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,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;
Expand Down

0 comments on commit e6bda3e

Please sign in to comment.