diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index c02e022ace70cb6d519ba1ce6c92a7abfeb3df7a..ff0aa6f87679d6898ebeba400a1f9b3337506aa2 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -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;