diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-10 08:19:14 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-11 13:32:17 -0400 |
commit | c0decac19da3906d9b66291e57b7759489e1170f (patch) | |
tree | 0eeb1f7d2c5464e0c87e0c788fd8fb581662c621 /drivers/media/platform/stm32/stm32-dcmi.c | |
parent | b730c40813a95ebc35757790a990794f55e2b61c (diff) | |
download | linux-stable-c0decac19da3906d9b66291e57b7759489e1170f.tar.gz linux-stable-c0decac19da3906d9b66291e57b7759489e1170f.tar.bz2 linux-stable-c0decac19da3906d9b66291e57b7759489e1170f.zip |
media: use strscpy() instead of strlcpy()
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL terminated strings.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/stm32/stm32-dcmi.c')
-rw-r--r-- | drivers/media/platform/stm32/stm32-dcmi.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c index 721564176d8c..ba3e2eee1d92 100644 --- a/drivers/media/platform/stm32/stm32-dcmi.c +++ b/drivers/media/platform/stm32/stm32-dcmi.c @@ -1147,10 +1147,10 @@ static int dcmi_s_selection(struct file *file, void *priv, static int dcmi_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - strlcpy(cap->driver, DRV_NAME, sizeof(cap->driver)); - strlcpy(cap->card, "STM32 Camera Memory Interface", + strscpy(cap->driver, DRV_NAME, sizeof(cap->driver)); + strscpy(cap->card, "STM32 Camera Memory Interface", sizeof(cap->card)); - strlcpy(cap->bus_info, "platform:dcmi", sizeof(cap->bus_info)); + strscpy(cap->bus_info, "platform:dcmi", sizeof(cap->bus_info)); return 0; } @@ -1161,7 +1161,7 @@ static int dcmi_enum_input(struct file *file, void *priv, return -EINVAL; i->type = V4L2_INPUT_TYPE_CAMERA; - strlcpy(i->name, "Camera", sizeof(i->name)); + strscpy(i->name, "Camera", sizeof(i->name)); return 0; } @@ -1736,7 +1736,7 @@ static int dcmi_probe(struct platform_device *pdev) dcmi->vdev->fops = &dcmi_fops; dcmi->vdev->v4l2_dev = &dcmi->v4l2_dev; dcmi->vdev->queue = &dcmi->queue; - strlcpy(dcmi->vdev->name, KBUILD_MODNAME, sizeof(dcmi->vdev->name)); + strscpy(dcmi->vdev->name, KBUILD_MODNAME, sizeof(dcmi->vdev->name)); dcmi->vdev->release = video_device_release; dcmi->vdev->ioctl_ops = &dcmi_ioctl_ops; dcmi->vdev->lock = &dcmi->lock; |