From: Jani Nikula <jani.nikula@intel.com>
To: Jani Nikula <jani.nikula@intel.com>, intel-gfx@lists.freedesktop.org
Cc: "Manasi Navare" <manasi.d.navare@intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: [Intel-gfx] [PATCH v2] drm/i915/dp: fix integer overflow in 128b/132b data rate calculation
Date: Tue, 26 Oct 2021 12:34:07 +0300 [thread overview]
Message-ID: <20211026093407.11381-1-jani.nikula@intel.com> (raw)
In-Reply-To: <20211026084208.2574-1-jani.nikula@intel.com>
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
v2: Use mul_u32_u32() (Ville)
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..537c689a1528 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(mul_u32_u32(max_link_rate_kbps, 9671), 10000);
max_link_rate = max_link_rate_kbps / 8;
}
--
2.30.2
next prev parent reply other threads:[~2021-10-26 9:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 8:42 [Intel-gfx] [PATCH] drm/i915/dp: fix integer overflow in 128b/132b data rate calculation Jani Nikula
2021-10-26 9:13 ` Ville Syrjälä
2021-10-26 9:34 ` Jani Nikula [this message]
2021-10-26 9:38 ` [Intel-gfx] [PATCH v2] " 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=20211026093407.11381-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox