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: f49308878d ("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>
This commit is contained in:
Hans Verkuil 2019-05-27 05:31:13 -04:00 committed by Mauro Carvalho Chehab
parent 3e6a515ff4
commit 518fa4e0e0
1 changed files with 3 additions and 2 deletions

View File

@ -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;
}