Re: [PATCH v5] drm/i915: Engine discovery query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Tvrtko Ursulin (2018-10-03 13:51:58)
> 
> On 03/10/2018 13:42, Chris Wilson wrote:
> > Quoting Chris Wilson (2018-10-03 13:28:09)
> >> Quoting Tvrtko Ursulin (2018-10-03 10:58:55)
> >>> +static int
> >>> +query_engine_info(struct drm_i915_private *i915,
> >>> +                 struct drm_i915_query_item *query_item)
> >>> +{
> >>> +       for_each_engine(engine, i915, id) {
> >>> +               struct drm_i915_engine_info info;
> >>> +
> >>> +               if (__copy_from_user(&info, info_ptr, sizeof(info)))
> >>> +                       return -EFAULT;
> >>> +
> >>> +               if (memcmp(&info, &zero_info, sizeof(info)))
> >>> +                       return -EINVAL;
> >>
> >> You want to have this be an in/out?
> 
> I am not sure, perhaps there isn't any benefit in checking that 
> userspace provided a zeroed block at this level since it is an out only 
> block. Instead I could just zero the unused fields for them?

Just struck me as being a bit overzealous (as I was thinking of a
write-esque syscall onto stack). (The first use that springs to mind for
info in here would be for filtering, and I'm not sure if we want to
start down that road ;) Yes, if we didn't do a copy_from_user
here, we would need a memset or info = {};
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux