[Intel-gfx] [PATCH 6/6] drm/i915: Support for capturing MMIO register values

Chris Wilson chris at chris-wilson.co.uk
Thu Mar 16 07:54:19 UTC 2017


On Thu, Mar 16, 2017 at 11:50:11AM +0530, sourab.gupta at intel.com wrote:
> +static int copy_mmio_list(struct drm_i915_private *dev_priv,
> +				void __user *mmio)
> +{
> +	void __user *mmio_list = ((u8 __user *)mmio + 4);
> +	u32 num_mmio;
> +	int ret;
> +
> +	if (!mmio)
> +		return -EINVAL;
> +
> +	ret = get_user(num_mmio, (u32 __user *)mmio);
> +	if (ret)
> +		return ret;
> +
> +	if (num_mmio > I915_PERF_MMIO_NUM_MAX)
> +		return -EINVAL;
> +
> +	memset(dev_priv->perf.mmio_list, 0, I915_PERF_MMIO_NUM_MAX);
> +	if (copy_from_user(dev_priv->perf.mmio_list, mmio_list, 4*num_mmio))

return -EFAULT;

check all the others (copy_from_user and copy_to_user).
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list