From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@intel.com,
"Manasi Navare" <manasi.d.navare@intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: [Intel-gfx] [PATCH] drm/i915/dp: fix integer overflow in 128b/132b data rate calculation
Date: Tue, 26 Oct 2021 11:42:07 +0300 [thread overview]
Message-ID: <20211026084208.2574-1-jani.nikula@intel.com> (raw)
The intermediate value 1000000 * 10 * 9671 overflows 32 bits, so force
promotion to a bigger type.
From the logs:
[drm:intel_dp_compute_config [i915]] DP link rate required 3657063 available -580783288
Fixes: 48efd014f0ea ("drm/i915/dp: add max data rate calculation for UHBR rates")
Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/gpu/drm/i915/display/intel_dp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index f5dc2126d140..9a0cd2e1ebea 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -352,7 +352,7 @@ intel_dp_max_data_rate(int max_link_rate, int max_lanes)
*/
int max_link_rate_kbps = max_link_rate * 10;
- max_link_rate_kbps = DIV_ROUND_CLOSEST_ULL(max_link_rate_kbps * 9671, 10000);
+ max_link_rate_kbps = DIV_ROUND_CLOSEST_ULL(max_link_rate_kbps * 9671UL, 10000UL);
max_link_rate = max_link_rate_kbps / 8;
}
--
2.30.2
next reply other threads:[~2021-10-26 8:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 8:42 Jani Nikula [this message]
2021-10-26 9:13 ` [Intel-gfx] [PATCH] drm/i915/dp: fix integer overflow in 128b/132b data rate calculation Ville Syrjälä
2021-10-26 9:34 ` [Intel-gfx] [PATCH v2] " Jani Nikula
2021-10-26 9:38 ` Ville Syrjälä
2021-10-26 16:05 ` Jani Nikula
2021-10-26 9:56 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/dp: fix integer overflow in 128b/132b data rate calculation (rev2) Patchwork
2021-10-26 10:30 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-10-26 11:53 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/dp: fix integer overflow in 128b/132b data rate calculation (rev3) Patchwork
2021-10-26 12:27 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-10-26 14:10 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " 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=20211026084208.2574-1-jani.nikula@intel.com \
--to=jani.nikula@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=manasi.d.navare@intel.com \
--cc=ville.syrjala@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.