projects
/
linux
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8a95079
)
[media] media-device: copy_to/from_user() returns positive
author
Dan Carpenter
<dan.carpenter@oracle.com>
Tue, 15 Dec 2015 11:00:40 +0000
(09:00 -0200)
committer
Mauro Carvalho Chehab
<mchehab@osg.samsung.com>
Mon, 11 Jan 2016 14:19:16 +0000
(12:19 -0200)
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>
drivers/media/media-device.c
patch
|
blob
|
history
diff --git
a/drivers/media/media-device.c
b/drivers/media/media-device.c
index b3e19c22e699099ab2a5a20245b4fe6118f05cf3..30e3354d7481480034c2ec6a96dc8ccb13976ab0 100644
(file)
--- a/
drivers/media/media-device.c
+++ b/
drivers/media/media-device.c
@@
-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,