Commit 7816f742 authored by Hans Verkuil's avatar Hans Verkuil Committed by Greg Kroah-Hartman

media: mc-device.c: don't memset __user pointer contents

[ Upstream commit 518fa4e0 ]

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: f4930887 ("media: media_device_enum_links32: clean a reserved field")
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 341b1fa4
...@@ -518,8 +518,9 @@ static long media_device_enum_links32(struct media_device *mdev, ...@@ -518,8 +518,9 @@ static long media_device_enum_links32(struct media_device *mdev,
if (ret) if (ret)
return 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment