mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-05 08:07:10 +07:00
[media] media-device: copy_to/from_user() returns positive
The copy_to/from_user() functions return the number of bytes *not* copied. They don't return error codes. Fixes: 4f6b3f363475 ('media] media-device: add support for MEDIA_IOC_G_TOPOLOGY ioctl') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
8a95079668
commit
a5c82e5622
@ -376,18 +376,17 @@ static long media_device_get_topology(struct media_device *mdev,
|
||||
struct media_v2_topology ktopo;
|
||||
int ret;
|
||||
|
||||
ret = copy_from_user(&ktopo, utopo, sizeof(ktopo));
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (copy_from_user(&ktopo, utopo, sizeof(ktopo)))
|
||||
return -EFAULT;
|
||||
|
||||
ret = __media_device_get_topology(mdev, &ktopo);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = copy_to_user(utopo, &ktopo, sizeof(*utopo));
|
||||
if (copy_to_user(utopo, &ktopo, sizeof(*utopo)))
|
||||
return -EFAULT;
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long media_device_ioctl(struct file *filp, unsigned int cmd,
|
||||
|
Loading…
Reference in New Issue
Block a user