<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 28, 2016 at 3:27 PM, Matthew Auld <span dir="ltr"><<a href="mailto:matthew.william.auld@gmail.com" target="_blank">matthew.william.auld@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> +/* Note we copy the properties from userspace outside of the i915 perf<br>
> + * mutex to avoid an awkward lockdep with mmap_sem.<br>
> + *<br>
> + * Note this function only validates properties in isolation it doesn't<br>
> + * validate that the combination of properties makes sense or that all<br>
> + * properties necessary for a particular kind of stream have been set.<br>
> + */<br>
> +static int read_properties_unlocked(<wbr>struct drm_i915_private *dev_priv,<br>
> + u64 __user *uprops,<br>
> + u32 n_props,<br>
> + struct perf_open_properties *props)<br>
> +{<br>
> + u64 __user *uprop = uprops;<br>
> + int i;<br>
> +<br>
> + memset(props, 0, sizeof(struct perf_open_properties));<br>
> +<br>
> + if (!n_props) {<br>
> + DRM_ERROR("No i915 perf properties given");<br>
> + return -EINVAL;<br>
> + }<br>
> +<br>
> + if (n_props > DRM_I915_PERF_PROP_MAX) {<br>
</span>Ah but DRM_I915_PERF_PROP_MAX is not a property itself.<br></blockquote><div><br></div><div>I'm not sure I follow what your implied concern is?<br><br></div><div>This is just a sanity check for the number properties given by userspace, based on the assumption that there's currently no reason for multiple values with a particular property id.<br></div></div><br></div></div>