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 | |
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')
-rw-r--r-- | drivers/media/platform/vimc/vimc-capture.c | 6 | ||||
-rw-r--r-- | drivers/media/platform/vimc/vimc-common.c | 2 | ||||
-rw-r--r-- | drivers/media/platform/vimc/vimc-core.c | 4 |
3 files changed, 6 insertions, 6 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, { struct vimc_cap_device *vcap = video_drvdata(file); - strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); - strlcpy(cap->card, KBUILD_MODNAME, sizeof(cap->card)); + strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); + strscpy(cap->card, KBUILD_MODNAME, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", vcap->vdev.v4l2_dev->name); @@ -476,7 +476,7 @@ static int vimc_cap_comp_bind(struct device *comp, struct device *master, vdev->queue = q; vdev->v4l2_dev = v4l2_dev; vdev->vfl_dir = VFL_DIR_RX; - strlcpy(vdev->name, pdata->entity_name, sizeof(vdev->name)); + strscpy(vdev->name, pdata->entity_name, sizeof(vdev->name)); video_set_drvdata(vdev, &vcap->ved); /* Register the video_device with the v4l2 and the media framework */ diff --git a/drivers/media/platform/vimc/vimc-common.c b/drivers/media/platform/vimc/vimc-common.c index 617415c224fe..dee1b9dfc4f6 100644 --- a/drivers/media/platform/vimc/vimc-common.c +++ b/drivers/media/platform/vimc/vimc-common.c @@ -430,7 +430,7 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved, sd->entity.function = function; sd->entity.ops = &vimc_ent_sd_mops; sd->owner = THIS_MODULE; - strlcpy(sd->name, name, sizeof(sd->name)); + strscpy(sd->name, name, sizeof(sd->name)); v4l2_set_subdevdata(sd, ved); /* Expose this subdev to user space */ diff --git a/drivers/media/platform/vimc/vimc-core.c b/drivers/media/platform/vimc/vimc-core.c index 9246f265de31..ce809d2e3d53 100644 --- a/drivers/media/platform/vimc/vimc-core.c +++ b/drivers/media/platform/vimc/vimc-core.c @@ -259,7 +259,7 @@ static struct component_match *vimc_add_subdevs(struct vimc_device *vimc) dev_dbg(&vimc->pdev.dev, "new pdev for %s\n", vimc->pipe_cfg->ents[i].drv); - strlcpy(pdata.entity_name, vimc->pipe_cfg->ents[i].name, + strscpy(pdata.entity_name, vimc->pipe_cfg->ents[i].name, sizeof(pdata.entity_name)); vimc->subdevs[i] = platform_device_register_data(&vimc->pdev.dev, @@ -317,7 +317,7 @@ static int vimc_probe(struct platform_device *pdev) vimc->v4l2_dev.mdev = &vimc->mdev; /* Initialize media device */ - strlcpy(vimc->mdev.model, VIMC_MDEV_MODEL_NAME, + strscpy(vimc->mdev.model, VIMC_MDEV_MODEL_NAME, sizeof(vimc->mdev.model)); vimc->mdev.dev = &pdev->dev; media_device_init(&vimc->mdev); |