[Intel-gfx] [PATCH v3 1/8] drm/i915: Make sure fb gtt offsets stay within 32bits
Ville Syrjälä
ville.syrjala at linux.intel.com
Thu Sep 27 12:24:59 UTC 2018
On Wed, Sep 26, 2018 at 09:09:31PM +0100, Chris Wilson wrote:
> Quoting Ville Syrjälä (2018-09-26 10:27:40)
> > On Tue, Sep 25, 2018 at 09:29:44PM +0100, Chris Wilson wrote:
> > > Quoting Ville Syrjala (2018-09-25 20:37:07)
> > > > From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> > > > + /* Catch potential overflows early */
> > > > + if (add_overflows(mul_u32_u32(height, fb->pitches[color_plane]),
> > > > + fb->offsets[color_plane], (u32)0)) {
> > >
> > > Should we just pass type? Atm we aren't using the value for anything.
> > > Then it would be add_overflows_t(a, b, T) with the obvious wrapping for
> > > add_overflows(a, b). Although to be consistent with min_t, perhaps
> > > add_overflows_t(T, a, b).
> >
> > Indeed, that does seem a bit more consistent with existing stuff.
>
> To further upset the apple cart, I spotted there is now a
> include/linux/overflows.h which does everything completely different.
Yeah. That one seems to enforce that the type of both operands is the
same which means to use it here I'd have to do the mul overflow check
separately. Also no __builtin_foo_p() used so would need to
actually store the result somewhere.
--
Ville Syrjälä
Intel
More information about the Intel-gfx
mailing list