Re: [PATCH v3 08/30] drivers: hv: dxgkrnl: Creation of dxgcontext objects

From: Wei Liu
Date: Wed Mar 02 2022 - 07:59:28 EST


On Tue, Mar 01, 2022 at 11:45:55AM -0800, Iouri Tarassov wrote:
[...]
> +static int
> +dxgk_create_context_virtual(struct dxgprocess *process, void *__user inargs)
> +{
> + struct d3dkmt_createcontextvirtual args;
> + int ret;
> + struct dxgadapter *adapter = NULL;
> + struct dxgdevice *device = NULL;
> + struct dxgcontext *context = NULL;
> + struct d3dkmthandle host_context_handle = {};
> + bool device_lock_acquired = false;
> +
> + pr_debug("ioctl: %s", __func__);
> +
> + ret = copy_from_user(&args, inargs, sizeof(args));
> + if (ret) {
> + pr_err("%s failed to copy input args", __func__);
> + ret = -EINVAL;

This should be -EFAULT. This goes for other copy_from_user calls too. You can also
drop the pr_err above.

Thanks,
Wei.