From: Jani Nikula <jani.nikula@intel.com>
To: Suraj Kandpal <suraj.kandpal@intel.com>,
intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: ankit.k.nautiyal@intel.com, Suraj Kandpal <suraj.kandpal@intel.com>
Subject: Re: [PATCH] drm/i915/dp: Use array size for intersect_rates() bound
Date: Tue, 04 Aug 2026 12:17:33 +0300 [thread overview]
Message-ID: <fc063639e68f981c433e8610110382d742eee76f@intel.com> (raw)
In-Reply-To: <20260804085658.1306761-1-suraj.kandpal@intel.com>
On Tue, 04 Aug 2026, Suraj Kandpal <suraj.kandpal@intel.com> wrote:
> Take an explicit common_len parameter and pass
> ARRAY_SIZE(intel_dp->common_rates) at the call site, so the bound is
> tied to the destination array.
>
> Fixes: e6bda3e4cb43 ("drm/i915: Avoid overflowing the DP link rate arrays")
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_dp.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index 7f13595f40c1..dd0fbb0ba20d 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -625,13 +625,13 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
>
> static int intersect_rates(const int *source_rates, int source_len,
> const int *sink_rates, int sink_len,
> - int *common_rates)
> + int *common_rates, int common_len)
> {
> int i = 0, j = 0, k = 0;
>
> while (i < source_len && j < sink_len) {
> if (source_rates[i] == sink_rates[j]) {
> - if (WARN_ON(k >= DP_MAX_SUPPORTED_RATES))
> + if (WARN_ON(k >= common_len))
> return k;
> common_rates[k] = source_rates[i];
> ++k;
> @@ -671,7 +671,8 @@ static void intel_dp_get_common_rates(struct intel_dp *intel_dp,
> intel_dp->num_source_rates,
> intel_dp->sink_rates,
> intel_dp->num_sink_rates,
> - common_rates);
> + intel_dp->common_rates,
> + ARRAY_SIZE(intel_dp->common_rates));
This is using some old baseline.
BR,
Jani.
>
> /* Paranoia, there should always be something in common. */
> if (drm_WARN_ON(display->drm, *num_common_rates == 0)) {
--
Jani Nikula, Intel
next prev parent reply other threads:[~2026-08-04 9:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 8:56 [PATCH] drm/i915/dp: Use array size for intersect_rates() bound Suraj Kandpal
2026-08-04 9:17 ` Jani Nikula [this message]
2026-08-04 10:55 ` [PATCH v2] " Suraj Kandpal
2026-08-05 5:38 ` Borah, Chaitanya Kumar
2026-08-05 7:44 ` Jani Nikula
2026-08-05 8:01 ` Borah, Chaitanya Kumar
2026-08-07 2:45 ` [PATCH v3] " Suraj Kandpal
2026-08-04 11:02 ` ✓ CI.KUnit: success for drm/i915/dp: Use array size for intersect_rates() bound (rev2) Patchwork
2026-08-04 11:46 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-04 17:55 ` ✓ Xe.CI.FULL: " Patchwork
2026-08-07 2:53 ` ✓ CI.KUnit: success for drm/i915/dp: Use array size for intersect_rates() bound (rev3) Patchwork
2026-08-07 3:30 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-07 15:37 ` ✓ Xe.CI.FULL: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fc063639e68f981c433e8610110382d742eee76f@intel.com \
--to=jani.nikula@intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=suraj.kandpal@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox