From: Jani Nikula <jani.nikula@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org,
Manasi Navare <manasi.d.navare@intel.com>
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/dp: fix integer overflow in 128b/132b data rate calculation
Date: Tue, 26 Oct 2021 19:05:13 +0300 [thread overview]
Message-ID: <877ddzkc06.fsf@intel.com> (raw)
In-Reply-To: <YXfMpUTtd9MwTsU3@intel.com>
On Tue, 26 Oct 2021, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Tue, Oct 26, 2021 at 12:34:07PM +0300, Jani Nikula wrote:
>> 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>
>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Thanks, pushed.
BR,
Jani.
>
>> ---
>> 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
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2021-10-26 17:07 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 ` [Intel-gfx] [PATCH v2] " Jani Nikula
2021-10-26 9:38 ` Ville Syrjälä
2021-10-26 16:05 ` Jani Nikula [this message]
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=877ddzkc06.fsf@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