[Intel-gfx] [PATCH v2 1/8] drm/i915: Fix unsigned overflow when calculating total data rate

Chris Wilson chris at chris-wilson.co.uk
Fri Oct 19 13:06:30 UTC 2018


Quoting Maarten Lankhorst (2018-10-19 14:03:47)
> Op 18-10-18 om 17:11 schreef Ville Syrjälä:
> > On Thu, Oct 18, 2018 at 01:51:27PM +0200, Maarten Lankhorst wrote:
> >> @@ -4402,8 +4401,7 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
> >>               * result is < available as data_rate / total_data_rate < 1
> >>               */
> >>              plane_blocks = minimum[plane_id];
> >> -            plane_blocks += div_u64((uint64_t)alloc_size * data_rate,
> >> -                                    total_data_rate);
> >> +            plane_blocks += alloc_size * data_rate / total_data_rate;
> > I failed to spot the raw 64bit divisions here. Fortunately CI caught
> > them (yay). Need to be fixed.
> No we can't, if we make the per plane data rate 64-bits, the divisor will overflow a div_u64..

div64_u64()
-Chris


More information about the Intel-gfx mailing list