Commit fe3dd71d authored by Dan Carpenter's avatar Dan Carpenter Committed by Alex Williamson

vfio/mlx5: fix error code in mlx5vf_precopy_ioctl()

The copy_to_user() function returns the number of bytes remaining to
be copied but we want to return a negative error code here.

Fixes: 0dce165b ("vfio/mlx5: Introduce vfio precopy ioctl implementation")
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Reviewed-by: default avatarYishai Hadas <yishaih@nvidia.com>
Link: https://lore.kernel.org/r/Y5IKVknlf5Z5NPtU@kiliSigned-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent d1f0f50f
......@@ -404,7 +404,10 @@ static long mlx5vf_precopy_ioctl(struct file *filp, unsigned int cmd,
done:
mlx5vf_state_mutex_unlock(mvdev);
return copy_to_user((void __user *)arg, &info, minsz);
if (copy_to_user((void __user *)arg, &info, minsz))
return -EFAULT;
return 0;
err_migf_unlock:
mutex_unlock(&migf->lock);
err_state_unlock:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment