diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2019-05-27 11:31:13 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-05-29 16:36:04 +0200 |
commit | 518fa4e0e0da97ea2e17c95ab57647ce748a96e2 (patch) | |
tree | 1442207955cfbaf7e3b2e8d4d7c6e99d650ea023 /drivers/media/mc | |
parent | media: media-ioc-enum-links.rst: fix incorrect reserved field documentation (diff) | |
download | linux-518fa4e0e0da97ea2e17c95ab57647ce748a96e2.tar.xz linux-518fa4e0e0da97ea2e17c95ab57647ce748a96e2.zip |
media: mc-device.c: don't memset __user pointer contents
You can't memset the contents of a __user pointer. Instead, call copy_to_user to
copy links.reserved (which is zeroed) to the user memory.
This fixes this sparse warning:
SPARSE:drivers/media/mc/mc-device.c drivers/media/mc/mc-device.c:521:16: warning: incorrect type in argument 1 (different address spaces)
Fixes: f49308878d720 ("media: media_device_enum_links32: clean a reserved field")
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/mc')
-rw-r--r-- | drivers/media/mc/mc-device.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/mc/mc-device.c b/drivers/media/mc/mc-device.c index 6893843edada..8e2a66493e62 100644 --- a/drivers/media/mc/mc-device.c +++ b/drivers/media/mc/mc-device.c @@ -518,8 +518,9 @@ static long media_device_enum_links32(struct media_device *mdev, if (ret) return ret; - memset(ulinks->reserved, 0, sizeof(ulinks->reserved)); - + if (copy_to_user(ulinks->reserved, links.reserved, + sizeof(ulinks->reserved))) + return -EFAULT; return 0; } |