Quoting Tvrtko Ursulin (2019-01-09 09:25:49) > > On 09/01/2019 07:51, Abdiel Janulgue wrote: > > This simplifies adding new query item objects. > > > > Signed-off-by: Abdiel Janulgue <abdiel.janulgue@xxxxxxxxxxxxxxx> > > Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > > --- > > drivers/gpu/drm/i915/i915_query.c | 40 ++++++++++++++++++++----------- > > 1 file changed, 26 insertions(+), 14 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/i915_query.c b/drivers/gpu/drm/i915/i915_query.c > > index cbcb957b7141..b4f26605f617 100644 > > --- a/drivers/gpu/drm/i915/i915_query.c > > +++ b/drivers/gpu/drm/i915/i915_query.c > > @@ -10,12 +10,33 @@ > > #include "i915_query.h" > > #include <uapi/drm/i915_drm.h> > > > > +static int init_query_item_check(void* data_ptr, size_t data_sz, > > void *ptr > > data_ prefix is not ideal since this is not the trailing data but the > query header. Maybe query_ ? Maybe query_hdr, query_pkt? Or hdr, pkt? > > + u32 total_length, > > + struct drm_i915_query_item *query_item) > > +{ > > + if (query_item->length == 0) > > + return total_length; > > + > > + if (query_item->length < total_length) > > + return -EINVAL; > > + > > + if (copy_from_user(data_ptr, u64_to_user_ptr(query_item->data_ptr), > > + data_sz)) > > + return -EFAULT; > > Is lost type information a concern with copy_from_user.. let me check.. > I am not sure TBH.. there seems to be type based object size check in > there but does it work when indirected via void*? iirc void* is fine, just loss of fancy static checking. -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx