public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] drm/i915/dp: fix integer overflow in 128b/132b data rate calculation
@ 2021-10-26  8:42 Jani Nikula
  2021-10-26  9:13 ` Ville Syrjälä
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Jani Nikula @ 2021-10-26  8:42 UTC (permalink / raw)
  To: intel-gfx; +Cc: jani.nikula, Manasi Navare, Ville Syrjälä

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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-10-26 17:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox