vfio-mdev: return -EFAULT if copy_to_user() fails
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 7 Jan 2017 06:27:49 +0000 (09:27 +0300)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 11 Jan 2017 19:06:35 +0000 (12:06 -0700)
commit6ed0993a0b859ce62edf2930ded683e452286d39
treed887337ec8e4b492163467fc95ef5672d35160aa
parenta121103c922847ba5010819a3f250f1f7fc84ab8
vfio-mdev: return -EFAULT if copy_to_user() fails

The copy_to_user() function returns the number of bytes which it wasn't
able to copy but we want to return a negative error code.

Fixes: 9d1a546c53b4 ("docs: Sample driver to demonstrate how to use Mediated device framework.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
samples/vfio-mdev/mtty.c