[Intel-gfx] [PATCH 07/39] drm/i915: Introduce the i915_user_extension_method

Chris Wilson chris at chris-wilson.co.uk
Thu Mar 14 14:59:50 UTC 2019


Quoting Tvrtko Ursulin (2019-03-14 14:52:00)
> 
> On 13/03/2019 14:43, Chris Wilson wrote:
> > +int i915_user_extensions(struct i915_user_extension __user *ext,
> > +                      const i915_user_extension_fn *tbl,
> > +                      unsigned long count,
> 
> Could shrink to unsigned int if going to 32-bit "name". And...
> 
> > +                      void *data)
> > +{
> > +     unsigned int stackdepth = 512;
> > +
> > +     while (ext) {
> > +             int i, err;
> > +             u64 x;
> 
> ... so it is u32 in this version.

This was a convenience to use one variable for both; it doesn't affect
the get_user() as that is determined by the sizeof(*ptr) and not the
local. However, it did upset array_index_nospec() on 32bit, so it did
become a u32. So unsigned int count also makes some sense, I was using
the natural type for ARRAY_SIZE() so that we didn't accidentally
truncate, but shrinking the array bound is not as harmful.
-Chris


More information about the Intel-gfx mailing list