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/atmel | |
parent | b730c40813a95ebc35757790a990794f55e2b61c (diff) |
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/atmel')
-rw-r--r-- | drivers/media/platform/atmel/atmel-isc.c | 2 | ||||
-rw-r--r-- | drivers/media/platform/atmel/atmel-isi.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/platform/atmel/atmel-isc.c b/drivers/media/platform/atmel/atmel-isc.c index d89e14524d42..776a92d7387f 100644 --- a/drivers/media/platform/atmel/atmel-isc.c +++ b/drivers/media/platform/atmel/atmel-isc.c @@ -1951,7 +1951,7 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier) INIT_WORK(&isc->awb_work, isc_awb_work); /* Register video device */ - strlcpy(vdev->name, ATMEL_ISC_NAME, sizeof(vdev->name)); + strscpy(vdev->name, ATMEL_ISC_NAME, sizeof(vdev->name)); vdev->release = video_device_release_empty; vdev->fops = &isc_fops; vdev->ioctl_ops = &isc_ioctl_ops; diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c index e8db4df1e7c4..26874575d381 100644 --- a/drivers/media/platform/atmel/atmel-isi.c +++ b/drivers/media/platform/atmel/atmel-isi.c @@ -655,9 +655,9 @@ static int isi_enum_fmt_vid_cap(struct file *file, void *priv, static int isi_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - strlcpy(cap->driver, "atmel-isi", sizeof(cap->driver)); - strlcpy(cap->card, "Atmel Image Sensor Interface", sizeof(cap->card)); - strlcpy(cap->bus_info, "platform:isi", sizeof(cap->bus_info)); + strscpy(cap->driver, "atmel-isi", sizeof(cap->driver)); + strscpy(cap->card, "Atmel Image Sensor Interface", sizeof(cap->card)); + strscpy(cap->bus_info, "platform:isi", sizeof(cap->bus_info)); return 0; } @@ -668,7 +668,7 @@ static int isi_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; } @@ -1202,7 +1202,7 @@ static int atmel_isi_probe(struct platform_device *pdev) isi->vdev->fops = &isi_fops; isi->vdev->v4l2_dev = &isi->v4l2_dev; isi->vdev->queue = &isi->queue; - strlcpy(isi->vdev->name, KBUILD_MODNAME, sizeof(isi->vdev->name)); + strscpy(isi->vdev->name, KBUILD_MODNAME, sizeof(isi->vdev->name)); isi->vdev->release = video_device_release; isi->vdev->ioctl_ops = &isi_ioctl_ops; isi->vdev->lock = &isi->lock; |