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/vimc/vimc-capture.c | |
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/vimc/vimc-capture.c')
-rw-r--r-- | drivers/media/platform/vimc/vimc-capture.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index ec68feaac378..3f7e9ed56633 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c | |||
@@ -71,8 +71,8 @@ static int vimc_cap_querycap(struct file *file, void *priv, | |||
71 | { | 71 | { |
72 | struct vimc_cap_device *vcap = video_drvdata(file); | 72 | struct vimc_cap_device *vcap = video_drvdata(file); |
73 | 73 | ||
74 | strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); | 74 | strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); |
75 | strlcpy(cap->card, KBUILD_MODNAME, sizeof(cap->card)); | 75 | strscpy(cap->card, KBUILD_MODNAME, sizeof(cap->card)); |
76 | snprintf(cap->bus_info, sizeof(cap->bus_info), | 76 | snprintf(cap->bus_info, sizeof(cap->bus_info), |
77 | "platform:%s", vcap->vdev.v4l2_dev->name); | 77 | "platform:%s", vcap->vdev.v4l2_dev->name); |
78 | 78 | ||
@@ -476,7 +476,7 @@ static int vimc_cap_comp_bind(struct device *comp, struct device *master, | |||
476 | vdev->queue = q; | 476 | vdev->queue = q; |
477 | vdev->v4l2_dev = v4l2_dev; | 477 | vdev->v4l2_dev = v4l2_dev; |
478 | vdev->vfl_dir = VFL_DIR_RX; | 478 | vdev->vfl_dir = VFL_DIR_RX; |
479 | strlcpy(vdev->name, pdata->entity_name, sizeof(vdev->name)); | 479 | strscpy(vdev->name, pdata->entity_name, sizeof(vdev->name)); |
480 | video_set_drvdata(vdev, &vcap->ved); | 480 | video_set_drvdata(vdev, &vcap->ved); |
481 | 481 | ||
482 | /* Register the video_device with the v4l2 and the media framework */ | 482 | /* Register the video_device with the v4l2 and the media framework */ |