diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-10 14:19:14 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-11 19:32:17 +0200 |
commit | c0decac19da3906d9b66291e57b7759489e1170f (patch) | |
tree | 0eeb1f7d2c5464e0c87e0c788fd8fb581662c621 /drivers/media/platform | |
parent | media: MAINTAINERS: add entry for i.MX PXP media mem2mem driver (diff) | |
download | linux-c0decac19da3906d9b66291e57b7759489e1170f.tar.xz linux-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')
78 files changed, 193 insertions, 192 deletions
diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c index b05738a95e55..28590cf3770b 100644 --- a/drivers/media/platform/am437x/am437x-vpfe.c +++ b/drivers/media/platform/am437x/am437x-vpfe.c @@ -1408,8 +1408,8 @@ static int vpfe_querycap(struct file *file, void *priv, vpfe_dbg(2, vpfe, "vpfe_querycap\n"); - strlcpy(cap->driver, VPFE_MODULE_NAME, sizeof(cap->driver)); - strlcpy(cap->card, "TI AM437x VPFE", sizeof(cap->card)); + strscpy(cap->driver, VPFE_MODULE_NAME, sizeof(cap->driver)); + strscpy(cap->card, "TI AM437x VPFE", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", vpfe->v4l2_dev.name); cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | @@ -2386,7 +2386,7 @@ static int vpfe_probe_complete(struct vpfe_device *vpfe) INIT_LIST_HEAD(&vpfe->dma_queue); vdev = &vpfe->video_dev; - strlcpy(vdev->name, VPFE_MODULE_NAME, sizeof(vdev->name)); + strscpy(vdev->name, VPFE_MODULE_NAME, sizeof(vdev->name)); vdev->release = video_device_release_empty; vdev->fops = &vpfe_fops; vdev->ioctl_ops = &vpfe_ioctl_ops; 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; diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index 726b3b93a486..0bffa1e02e58 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c @@ -390,10 +390,10 @@ static int coda_querycap(struct file *file, void *priv, { struct coda_ctx *ctx = fh_to_ctx(priv); - strlcpy(cap->driver, CODA_NAME, sizeof(cap->driver)); - strlcpy(cap->card, coda_product_name(ctx->dev->devtype->product), + strscpy(cap->driver, CODA_NAME, sizeof(cap->driver)); + strscpy(cap->card, coda_product_name(ctx->dev->devtype->product), sizeof(cap->card)); - strlcpy(cap->bus_info, "platform:" CODA_NAME, sizeof(cap->bus_info)); + strscpy(cap->bus_info, "platform:" CODA_NAME, sizeof(cap->bus_info)); cap->device_caps = V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; @@ -2408,7 +2408,7 @@ static int coda_register_device(struct coda_dev *dev, int i) if (i >= dev->devtype->num_vdevs) return -EINVAL; - strlcpy(vfd->name, dev->devtype->vdevs[i]->name, sizeof(vfd->name)); + strscpy(vfd->name, dev->devtype->vdevs[i]->name, sizeof(vfd->name)); vfd->fops = &coda_fops; vfd->ioctl_ops = &coda_ioctl_ops; vfd->release = video_device_release_empty, diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index b0eb3d899eb4..a96c9337ae58 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -647,7 +647,7 @@ static int vpbe_display_querycap(struct file *file, void *priv, dev_name(vpbe_dev->pdev)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(vpbe_dev->pdev)); - strlcpy(cap->card, vpbe_dev->cfg->module_name, sizeof(cap->card)); + strscpy(cap->card, vpbe_dev->cfg->module_name, sizeof(cap->card)); return 0; } diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index 8613358ed245..ea3ddd5a42bd 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c @@ -889,9 +889,9 @@ static int vpfe_querycap(struct file *file, void *priv, cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; - strlcpy(cap->driver, CAPTURE_DRV_NAME, sizeof(cap->driver)); - strlcpy(cap->bus_info, "VPFE", sizeof(cap->bus_info)); - strlcpy(cap->card, vpfe_dev->cfg->card_name, sizeof(cap->card)); + strscpy(cap->driver, CAPTURE_DRV_NAME, sizeof(cap->driver)); + strscpy(cap->bus_info, "VPFE", sizeof(cap->bus_info)); + strscpy(cap->card, vpfe_dev->cfg->card_name, sizeof(cap->card)); return 0; } diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index a96f53ce8088..f0c2508a6e2e 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1094,10 +1094,10 @@ static int vpif_querycap(struct file *file, void *priv, cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; - strlcpy(cap->driver, VPIF_DRIVER_NAME, sizeof(cap->driver)); + strscpy(cap->driver, VPIF_DRIVER_NAME, sizeof(cap->driver)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(vpif_dev)); - strlcpy(cap->card, config->card_name, sizeof(cap->card)); + strscpy(cap->card, config->card_name, sizeof(cap->card)); return 0; } @@ -1463,7 +1463,7 @@ static int vpif_probe_complete(void) /* Initialize the video_device structure */ vdev = &ch->video_dev; - strlcpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name)); + strscpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name)); vdev->release = video_device_release_empty; vdev->fops = &vpif_fops; vdev->ioctl_ops = &vpif_ioctl_ops; diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index 0f324055cc9f..fec4341eb93e 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -586,10 +586,10 @@ static int vpif_querycap(struct file *file, void *priv, cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; - strlcpy(cap->driver, VPIF_DRIVER_NAME, sizeof(cap->driver)); + strscpy(cap->driver, VPIF_DRIVER_NAME, sizeof(cap->driver)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(vpif_dev)); - strlcpy(cap->card, config->card_name, sizeof(cap->card)); + strscpy(cap->card, config->card_name, sizeof(cap->card)); return 0; } @@ -1209,7 +1209,7 @@ static int vpif_probe_complete(void) /* Initialize the video_device structure */ vdev = &ch->video_dev; - strlcpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name)); + strscpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name)); vdev->release = video_device_release_empty; vdev->fops = &vpif_fops; vdev->ioctl_ops = &vpif_ioctl_ops; diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 17854a379243..838c5c53de37 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -339,7 +339,7 @@ int gsc_enum_fmt_mplane(struct v4l2_fmtdesc *f) if (!fmt) return -EINVAL; - strlcpy(f->description, fmt->name, sizeof(f->description)); + strscpy(f->description, fmt->name, sizeof(f->description)); f->pixelformat = fmt->pixelformat; return 0; diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index c9d2f6c5311a..cc5d690818e1 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -294,8 +294,8 @@ static int gsc_m2m_querycap(struct file *file, void *fh, struct gsc_ctx *ctx = fh_to_ctx(fh); struct gsc_dev *gsc = ctx->gsc_dev; - strlcpy(cap->driver, GSC_MODULE_NAME, sizeof(cap->driver)); - strlcpy(cap->card, GSC_MODULE_NAME " gscaler", sizeof(cap->card)); + strscpy(cap->driver, GSC_MODULE_NAME, sizeof(cap->driver)); + strscpy(cap->card, GSC_MODULE_NAME " gscaler", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(&gsc->pdev->dev)); cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE; diff --git a/drivers/media/platform/exynos4-is/common.c b/drivers/media/platform/exynos4-is/common.c index b90f5bb15517..76f557548dfc 100644 --- a/drivers/media/platform/exynos4-is/common.c +++ b/drivers/media/platform/exynos4-is/common.c @@ -40,8 +40,8 @@ EXPORT_SYMBOL(fimc_find_remote_sensor); void __fimc_vidioc_querycap(struct device *dev, struct v4l2_capability *cap, unsigned int caps) { - strlcpy(cap->driver, dev->driver->name, sizeof(cap->driver)); - strlcpy(cap->card, dev->driver->name, sizeof(cap->card)); + strscpy(cap->driver, dev->driver->name, sizeof(cap->driver)); + strscpy(cap->card, dev->driver->name, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(dev)); cap->device_caps = caps; diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c index a3cdac188190..f56220e549bb 100644 --- a/drivers/media/platform/exynos4-is/fimc-capture.c +++ b/drivers/media/platform/exynos4-is/fimc-capture.c @@ -1087,7 +1087,7 @@ static int fimc_cap_enum_input(struct file *file, void *priv, fimc_md_graph_unlock(ve); if (sd) - strlcpy(i->name, sd->name, sizeof(i->name)); + strscpy(i->name, sd->name, sizeof(i->name)); return 0; } diff --git a/drivers/media/platform/exynos4-is/fimc-is-i2c.c b/drivers/media/platform/exynos4-is/fimc-is-i2c.c index 70dd4852b2b9..be937caf7645 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-i2c.c +++ b/drivers/media/platform/exynos4-is/fimc-is-i2c.c @@ -57,7 +57,7 @@ static int fimc_is_i2c_probe(struct platform_device *pdev) i2c_adap = &isp_i2c->adapter; i2c_adap->dev.of_node = node; i2c_adap->dev.parent = &pdev->dev; - strlcpy(i2c_adap->name, "exynos4x12-isp-i2c", sizeof(i2c_adap->name)); + strscpy(i2c_adap->name, "exynos4x12-isp-i2c", sizeof(i2c_adap->name)); i2c_adap->owner = THIS_MODULE; i2c_adap->algo = &fimc_is_i2c_algorithm; i2c_adap->class = I2C_CLASS_SPD; diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c index a920164f53f1..de6bd28f7e31 100644 --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c @@ -365,7 +365,7 @@ static int isp_video_enum_fmt_mplane(struct file *file, void *priv, if (WARN_ON(fmt == NULL)) return -EINVAL; - strlcpy(f->description, fmt->name, sizeof(f->description)); + strscpy(f->description, fmt->name, sizeof(f->description)); f->pixelformat = fmt->fourcc; return 0; diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c index 70d5f5586a5d..96f0a8a0dcae 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.c +++ b/drivers/media/platform/exynos4-is/fimc-lite.c @@ -654,8 +654,8 @@ static int fimc_lite_querycap(struct file *file, void *priv, { struct fimc_lite *fimc = video_drvdata(file); - strlcpy(cap->driver, FIMC_LITE_DRV_NAME, sizeof(cap->driver)); - strlcpy(cap->card, FIMC_LITE_DRV_NAME, sizeof(cap->card)); + strscpy(cap->driver, FIMC_LITE_DRV_NAME, sizeof(cap->driver)); + strscpy(cap->card, FIMC_LITE_DRV_NAME, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(&fimc->pdev->dev)); @@ -673,7 +673,7 @@ static int fimc_lite_enum_fmt_mplane(struct file *file, void *priv, return -EINVAL; fmt = &fimc_lite_formats[f->index]; - strlcpy(f->description, fmt->name, sizeof(f->description)); + strscpy(f->description, fmt->name, sizeof(f->description)); f->pixelformat = fmt->fourcc; return 0; diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index deb499f76412..18a393f51a26 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -1204,9 +1204,9 @@ static ssize_t fimc_md_sysfs_show(struct device *dev, struct fimc_md *fmd = dev_get_drvdata(dev); if (fmd->user_subdev_api) - return strlcpy(buf, "Sub-device API (sub-dev)\n", PAGE_SIZE); + return strscpy(buf, "Sub-device API (sub-dev)\n", PAGE_SIZE); - return strlcpy(buf, "V4L2 video node only API (vid-dev)\n", PAGE_SIZE); + return strscpy(buf, "V4L2 video node only API (vid-dev)\n", PAGE_SIZE); } static ssize_t fimc_md_sysfs_store(struct device *dev, @@ -1426,7 +1426,7 @@ static int fimc_md_probe(struct platform_device *pdev) INIT_LIST_HEAD(&fmd->pipelines); fmd->pdev = pdev; - strlcpy(fmd->media_dev.model, "SAMSUNG S5P FIMC", + strscpy(fmd->media_dev.model, "SAMSUNG S5P FIMC", sizeof(fmd->media_dev.model)); fmd->media_dev.ops = &fimc_md_ops; fmd->media_dev.dev = dev; @@ -1434,7 +1434,7 @@ static int fimc_md_probe(struct platform_device *pdev) v4l2_dev = &fmd->v4l2_dev; v4l2_dev->mdev = &fmd->media_dev; v4l2_dev->notify = fimc_sensor_notify; - strlcpy(v4l2_dev->name, "s5p-fimc-md", sizeof(v4l2_dev->name)); + strscpy(v4l2_dev->name, "s5p-fimc-md", sizeof(v4l2_dev->name)); fmd->use_isp = fimc_md_is_isp_available(dev->of_node); fmd->user_subdev_api = true; diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c index 5f84d2aa47ab..c62e598ee7d0 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -438,9 +438,9 @@ static void deinterlace_device_run(void *priv) static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - strlcpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver)); - strlcpy(cap->card, MEM2MEM_NAME, sizeof(cap->card)); - strlcpy(cap->bus_info, MEM2MEM_NAME, sizeof(cap->card)); + strscpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver)); + strscpy(cap->card, MEM2MEM_NAME, sizeof(cap->card)); + strscpy(cap->bus_info, MEM2MEM_NAME, sizeof(cap->card)); /* * This is only a mem-to-mem video device. The capture and output * device capability flags are left only for backward compatibility @@ -474,7 +474,7 @@ static int enum_fmt(struct v4l2_fmtdesc *f, u32 type) if (i < NUM_FORMATS) { /* Format found */ fmt = &formats[i]; - strlcpy(f->description, fmt->name, sizeof(f->description)); + strscpy(f->description, fmt->name, sizeof(f->description)); f->pixelformat = fmt->fourcc; return 0; } diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c index dfdbd4354b74..c47011194710 100644 --- a/drivers/media/platform/marvell-ccic/mcam-core.c +++ b/drivers/media/platform/marvell-ccic/mcam-core.c @@ -1305,7 +1305,7 @@ static int mcam_vidioc_querycap(struct file *file, void *priv, strcpy(cap->driver, "marvell_ccic"); strcpy(cap->card, "marvell_ccic"); - strlcpy(cap->bus_info, cam->bus_info, sizeof(cap->bus_info)); + strscpy(cap->bus_info, cam->bus_info, sizeof(cap->bus_info)); cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; @@ -1318,8 +1318,8 @@ static int mcam_vidioc_enum_fmt_vid_cap(struct file *filp, { if (fmt->index >= N_MCAM_FMTS) return -EINVAL; - strlcpy(fmt->description, mcam_formats[fmt->index].desc, - sizeof(fmt->description)); + strscpy(fmt->description, mcam_formats[fmt->index].desc, + sizeof(fmt->description)); fmt->pixelformat = mcam_formats[fmt->index].pixelformat; return 0; } diff --git a/drivers/media/platform/marvell-ccic/mmp-driver.c b/drivers/media/platform/marvell-ccic/mmp-driver.c index 6d9f0abb2660..41968cd388ac 100644 --- a/drivers/media/platform/marvell-ccic/mmp-driver.c +++ b/drivers/media/platform/marvell-ccic/mmp-driver.c @@ -371,7 +371,7 @@ static int mmpcam_probe(struct platform_device *pdev) mcam->lane = pdata->lane; mcam->chip_id = MCAM_ARMADA610; mcam->buffer_mode = B_DMA_sg; - strlcpy(mcam->bus_info, "platform:mmp-camera", sizeof(mcam->bus_info)); + strscpy(mcam->bus_info, "platform:mmp-camera", sizeof(mcam->bus_info)); spin_lock_init(&mcam->dev_lock); /* * Get our I/O memory. diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 4f24da8afecc..2a5d5002c27e 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -94,8 +94,8 @@ static int mtk_jpeg_querycap(struct file *file, void *priv, { struct mtk_jpeg_dev *jpeg = video_drvdata(file); - strlcpy(cap->driver, MTK_JPEG_NAME " decoder", sizeof(cap->driver)); - strlcpy(cap->card, MTK_JPEG_NAME " decoder", sizeof(cap->card)); + strscpy(cap->driver, MTK_JPEG_NAME " decoder", sizeof(cap->driver)); + strscpy(cap->card, MTK_JPEG_NAME " decoder", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(jpeg->dev)); diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c index ceffc31cc6eb..51a13466261e 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c @@ -619,9 +619,9 @@ static int mtk_mdp_m2m_querycap(struct file *file, void *fh, struct mtk_mdp_ctx *ctx = fh_to_ctx(fh); struct mtk_mdp_dev *mdp = ctx->mdp_dev; - strlcpy(cap->driver, MTK_MDP_MODULE_NAME, sizeof(cap->driver)); - strlcpy(cap->card, mdp->pdev->name, sizeof(cap->card)); - strlcpy(cap->bus_info, "platform:mt8173", sizeof(cap->bus_info)); + strscpy(cap->driver, MTK_MDP_MODULE_NAME, sizeof(cap->driver)); + strscpy(cap->card, mdp->pdev->name, sizeof(cap->card)); + strscpy(cap->bus_info, "platform:mt8173", sizeof(cap->bus_info)); return 0; } diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c index 0c8a8b4c4e1c..ba619647bc10 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c @@ -613,9 +613,9 @@ static int vidioc_vdec_dqbuf(struct file *file, void *priv, static int vidioc_vdec_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - strlcpy(cap->driver, MTK_VCODEC_DEC_NAME, sizeof(cap->driver)); - strlcpy(cap->bus_info, MTK_PLATFORM_STR, sizeof(cap->bus_info)); - strlcpy(cap->card, MTK_PLATFORM_STR, sizeof(cap->card)); + strscpy(cap->driver, MTK_VCODEC_DEC_NAME, sizeof(cap->driver)); + strscpy(cap->bus_info, MTK_PLATFORM_STR, sizeof(cap->bus_info)); + strscpy(cap->card, MTK_PLATFORM_STR, sizeof(cap->card)); return 0; } diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c index 6ad408514a99..54631ad1c71e 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c @@ -222,9 +222,9 @@ static int vidioc_enum_fmt_vid_out_mplane(struct file *file, void *prov, static int vidioc_venc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - strlcpy(cap->driver, MTK_VCODEC_ENC_NAME, sizeof(cap->driver)); - strlcpy(cap->bus_info, MTK_PLATFORM_STR, sizeof(cap->bus_info)); - strlcpy(cap->card, MTK_PLATFORM_STR, sizeof(cap->card)); + strscpy(cap->driver, MTK_VCODEC_ENC_NAME, sizeof(cap->driver)); + strscpy(cap->bus_info, MTK_PLATFORM_STR, sizeof(cap->bus_info)); + strscpy(cap->card, MTK_PLATFORM_STR, sizeof(cap->card)); return 0; } diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c index 64195c4ddeaf..27b078cf98e3 100644 --- a/drivers/media/platform/mx2_emmaprp.c +++ b/drivers/media/platform/mx2_emmaprp.c @@ -413,7 +413,7 @@ static int enum_fmt(struct v4l2_fmtdesc *f, u32 type) if (i < NUM_FORMATS) { /* Format found */ fmt = &formats[i]; - strlcpy(f->description, fmt->name, sizeof(f->description) - 1); + strscpy(f->description, fmt->name, sizeof(f->description) - 1); f->pixelformat = fmt->fourcc; return 0; } diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c index 5700b7818621..f447ae3bb465 100644 --- a/drivers/media/platform/omap/omap_vout.c +++ b/drivers/media/platform/omap/omap_vout.c @@ -1041,8 +1041,8 @@ static int vidioc_querycap(struct file *file, void *fh, { struct omap_vout_device *vout = fh; - strlcpy(cap->driver, VOUT_NAME, sizeof(cap->driver)); - strlcpy(cap->card, vout->vfd->name, sizeof(cap->card)); + strscpy(cap->driver, VOUT_NAME, sizeof(cap->driver)); + strscpy(cap->card, vout->vfd->name, sizeof(cap->card)); cap->bus_info[0] = '\0'; cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_OVERLAY; @@ -1060,8 +1060,8 @@ static int vidioc_enum_fmt_vid_out(struct file *file, void *fh, return -EINVAL; fmt->flags = omap_formats[index].flags; - strlcpy(fmt->description, omap_formats[index].description, - sizeof(fmt->description)); + strscpy(fmt->description, omap_formats[index].description, + sizeof(fmt->description)); fmt->pixelformat = omap_formats[index].pixelformat; return 0; @@ -1868,7 +1868,7 @@ static int __init omap_vout_setup_video_data(struct omap_vout_device *vout) vfd->release = video_device_release; vfd->ioctl_ops = &vout_ioctl_ops; - strlcpy(vfd->name, VOUT_NAME, sizeof(vfd->name)); + strscpy(vfd->name, VOUT_NAME, sizeof(vfd->name)); vfd->fops = &omap_vout_fops; vfd->v4l2_dev = &vout->vid_dev->v4l2_dev; diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 842e2235047d..93f032a39470 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -1677,7 +1677,7 @@ static int isp_register_entities(struct isp_device *isp) int ret; isp->media_dev.dev = isp->dev; - strlcpy(isp->media_dev.model, "TI OMAP3 ISP", + strscpy(isp->media_dev.model, "TI OMAP3 ISP", sizeof(isp->media_dev.model)); isp->media_dev.hw_revision = isp->revision; isp->media_dev.ops = &isp_media_ops; diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c index 77b73e27a274..14a1c24037c4 100644 --- a/drivers/media/platform/omap3isp/ispccdc.c +++ b/drivers/media/platform/omap3isp/ispccdc.c @@ -2641,7 +2641,7 @@ static int ccdc_init_entities(struct isp_ccdc_device *ccdc) v4l2_subdev_init(sd, &ccdc_v4l2_ops); sd->internal_ops = &ccdc_v4l2_internal_ops; - strlcpy(sd->name, "OMAP3 ISP CCDC", sizeof(sd->name)); + strscpy(sd->name, "OMAP3 ISP CCDC", sizeof(sd->name)); sd->grp_id = 1 << 16; /* group ID for isp subdevs */ v4l2_set_subdevdata(sd, ccdc); sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE; diff --git a/drivers/media/platform/omap3isp/ispccp2.c b/drivers/media/platform/omap3isp/ispccp2.c index e062939d0d05..2dea423ffc0e 100644 --- a/drivers/media/platform/omap3isp/ispccp2.c +++ b/drivers/media/platform/omap3isp/ispccp2.c @@ -1070,7 +1070,7 @@ static int ccp2_init_entities(struct isp_ccp2_device *ccp2) v4l2_subdev_init(sd, &ccp2_sd_ops); sd->internal_ops = &ccp2_sd_internal_ops; - strlcpy(sd->name, "OMAP3 ISP CCP2", sizeof(sd->name)); + strscpy(sd->name, "OMAP3 ISP CCP2", sizeof(sd->name)); sd->grp_id = 1 << 16; /* group ID for isp subdevs */ v4l2_set_subdevdata(sd, ccp2); sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; diff --git a/drivers/media/platform/omap3isp/ispcsi2.c b/drivers/media/platform/omap3isp/ispcsi2.c index a4d3d030e81e..9c180f607bcb 100644 --- a/drivers/media/platform/omap3isp/ispcsi2.c +++ b/drivers/media/platform/omap3isp/ispcsi2.c @@ -1234,7 +1234,7 @@ static int csi2_init_entities(struct isp_csi2_device *csi2) v4l2_subdev_init(sd, &csi2_ops); sd->internal_ops = &csi2_internal_ops; - strlcpy(sd->name, "OMAP3 ISP CSI2a", sizeof(sd->name)); + strscpy(sd->name, "OMAP3 ISP CSI2a", sizeof(sd->name)); sd->grp_id = 1 << 16; /* group ID for isp subdevs */ v4l2_set_subdevdata(sd, csi2); diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c index 3195f7c8b8b7..6ea6aeafd751 100644 --- a/drivers/media/platform/omap3isp/isppreview.c +++ b/drivers/media/platform/omap3isp/isppreview.c @@ -2267,7 +2267,7 @@ static int preview_init_entities(struct isp_prev_device *prev) v4l2_subdev_init(sd, &preview_v4l2_ops); sd->internal_ops = &preview_v4l2_internal_ops; - strlcpy(sd->name, "OMAP3 ISP preview", sizeof(sd->name)); + strscpy(sd->name, "OMAP3 ISP preview", sizeof(sd->name)); sd->grp_id = 1 << 16; /* group ID for isp subdevs */ v4l2_set_subdevdata(sd, prev); sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; diff --git a/drivers/media/platform/omap3isp/ispresizer.c b/drivers/media/platform/omap3isp/ispresizer.c index 0b6a87508584..b281cae036b3 100644 --- a/drivers/media/platform/omap3isp/ispresizer.c +++ b/drivers/media/platform/omap3isp/ispresizer.c @@ -1723,7 +1723,7 @@ static int resizer_init_entities(struct isp_res_device *res) v4l2_subdev_init(sd, &resizer_v4l2_ops); sd->internal_ops = &resizer_v4l2_internal_ops; - strlcpy(sd->name, "OMAP3 ISP resizer", sizeof(sd->name)); + strscpy(sd->name, "OMAP3 ISP resizer", sizeof(sd->name)); sd->grp_id = 1 << 16; /* group ID for isp subdevs */ v4l2_set_subdevdata(sd, res); sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c index 9d228eac24ea..5658f6a326f7 100644 --- a/drivers/media/platform/omap3isp/ispvideo.c +++ b/drivers/media/platform/omap3isp/ispvideo.c @@ -654,9 +654,9 @@ isp_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { struct isp_video *video = video_drvdata(file); - strlcpy(cap->driver, ISP_VIDEO_DRIVER_NAME, sizeof(cap->driver)); - strlcpy(cap->card, video->video.name, sizeof(cap->card)); - strlcpy(cap->bus_info, "media", sizeof(cap->bus_info)); + strscpy(cap->driver, ISP_VIDEO_DRIVER_NAME, sizeof(cap->driver)); + strscpy(cap->card, video->video.name, sizeof(cap->card)); + strscpy(cap->bus_info, "media", sizeof(cap->bus_info)); cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS; @@ -1251,7 +1251,7 @@ isp_video_enum_input(struct file *file, void *fh, struct v4l2_input *input) if (input->index > 0) return -EINVAL; - strlcpy(input->name, "camera", sizeof(input->name)); + strscpy(input->name, "camera", sizeof(input->name)); input->type = V4L2_INPUT_TYPE_CAMERA; return 0; diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c index b6e9e93bde7a..3288d22de2a0 100644 --- a/drivers/media/platform/pxa_camera.c +++ b/drivers/media/platform/pxa_camera.c @@ -1994,9 +1994,9 @@ static int pxac_vidioc_s_fmt_vid_cap(struct file *filp, void *priv, static int pxac_vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - strlcpy(cap->bus_info, "platform:pxa-camera", sizeof(cap->bus_info)); - strlcpy(cap->driver, PXA_CAM_DRV_NAME, sizeof(cap->driver)); - strlcpy(cap->card, pxa_cam_driver_description, sizeof(cap->card)); + strscpy(cap->bus_info, "platform:pxa-camera", sizeof(cap->bus_info)); + strscpy(cap->driver, PXA_CAM_DRV_NAME, sizeof(cap->driver)); + strscpy(cap->card, pxa_cam_driver_description, sizeof(cap->card)); cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; @@ -2010,7 +2010,7 @@ static int pxac_vidioc_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; } diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c index c9bb0d023db4..58aebe7114cd 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -521,8 +521,8 @@ static int video_querycap(struct file *file, void *fh, { struct camss_video *video = video_drvdata(file); - strlcpy(cap->driver, "qcom-camss", sizeof(cap->driver)); - strlcpy(cap->card, "Qualcomm Camera Subsystem", sizeof(cap->card)); + strscpy(cap->driver, "qcom-camss", sizeof(cap->driver)); + strscpy(cap->card, "Qualcomm Camera Subsystem", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(video->camss->dev)); @@ -683,7 +683,7 @@ static int video_enum_input(struct file *file, void *fh, if (input->index > 0) return -EINVAL; - strlcpy(input->name, "camera", sizeof(input->name)); + strscpy(input->name, "camera", sizeof(input->name)); input->type = V4L2_INPUT_TYPE_CAMERA; return 0; @@ -919,7 +919,7 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev, vdev->vfl_dir = VFL_DIR_RX; vdev->queue = &video->vb2_q; vdev->lock = &video->lock; - strlcpy(vdev->name, name, sizeof(vdev->name)); + strscpy(vdev->name, name, sizeof(vdev->name)); ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); if (ret < 0) { diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 669615fff6a0..a838a7e560e3 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -876,7 +876,7 @@ static int camss_probe(struct platform_device *pdev) return ret; camss->media_dev.dev = camss->dev; - strlcpy(camss->media_dev.model, "Qualcomm Camera Subsystem", + strscpy(camss->media_dev.model, "Qualcomm Camera Subsystem", sizeof(camss->media_dev.model)); camss->media_dev.ops = &camss_media_ops; media_device_init(&camss->media_dev); diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index dfbbbf0f746f..991e1583b92a 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -341,9 +341,9 @@ vdec_g_selection(struct file *file, void *fh, struct v4l2_selection *s) static int vdec_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { - strlcpy(cap->driver, "qcom-venus", sizeof(cap->driver)); - strlcpy(cap->card, "Qualcomm Venus video decoder", sizeof(cap->card)); - strlcpy(cap->bus_info, "platform:qcom-venus", sizeof(cap->bus_info)); + strscpy(cap->driver, "qcom-venus", sizeof(cap->driver)); + strscpy(cap->card, "Qualcomm Venus video decoder", sizeof(cap->card)); + strscpy(cap->bus_info, "platform:qcom-venus", sizeof(cap->bus_info)); return 0; } @@ -1153,7 +1153,7 @@ static int vdec_probe(struct platform_device *pdev) if (!vdev) return -ENOMEM; - strlcpy(vdev->name, "qcom-venus-decoder", sizeof(vdev->name)); + strscpy(vdev->name, "qcom-venus-decoder", sizeof(vdev->name)); vdev->release = video_device_release; vdev->fops = &vdec_fops; vdev->ioctl_ops = &vdec_ioctl_ops; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 41249d1443fa..ce85962b6adc 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -273,9 +273,9 @@ static int venc_v4l2_to_hfi(int id, int value) static int venc_querycap(struct file *file, void *fh, struct v4l2_capability *cap) { - strlcpy(cap->driver, "qcom-venus", sizeof(cap->driver)); - strlcpy(cap->card, "Qualcomm Venus video encoder", sizeof(cap->card)); - strlcpy(cap->bus_info, "platform:qcom-venus", sizeof(cap->bus_info)); + strscpy(cap->driver, "qcom-venus", sizeof(cap->driver)); + strscpy(cap->card, "Qualcomm Venus video encoder", sizeof(cap->card)); + strscpy(cap->bus_info, "platform:qcom-venus", sizeof(cap->bus_info)); return 0; } @@ -1257,7 +1257,7 @@ static int venc_probe(struct platform_device *pdev) if (!vdev) return -ENOMEM; - strlcpy(vdev->name, "qcom-venus-encoder", sizeof(vdev->name)); + strscpy(vdev->name, "qcom-venus-encoder", sizeof(vdev->name)); vdev->release = video_device_release; vdev->fops = &venc_fops; vdev->ioctl_ops = &venc_ioctl_ops; diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index ce09799976ef..5dd16af3625c 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -268,8 +268,8 @@ static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin) match = of_match_node(vin->dev->driver->of_match_table, vin->dev->of_node); - strlcpy(mdev->driver_name, KBUILD_MODNAME, sizeof(mdev->driver_name)); - strlcpy(mdev->model, match->compatible, sizeof(mdev->model)); + strscpy(mdev->driver_name, KBUILD_MODNAME, sizeof(mdev->driver_name)); + strscpy(mdev->model, match->compatible, sizeof(mdev->model)); snprintf(mdev->bus_info, sizeof(mdev->bus_info), "platform:%s", dev_name(mdev->dev)); diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 5a54779cfc27..dc77682b4785 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -238,8 +238,8 @@ static int rvin_querycap(struct file *file, void *priv, { struct rvin_dev *vin = video_drvdata(file); - strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); - strlcpy(cap->card, "R_Car_VIN", sizeof(cap->card)); + strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); + strscpy(cap->card, "R_Car_VIN", sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(vin->dev)); return 0; @@ -440,7 +440,7 @@ static int rvin_enum_input(struct file *file, void *priv, i->std = vin->vdev.tvnorms; } - strlcpy(i->name, "Camera", sizeof(i->name)); + strscpy(i->name, "Camera", sizeof(i->name)); return 0; } @@ -714,7 +714,7 @@ static int rvin_mc_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; } diff --git a/drivers/media/platform/rcar_drif.c b/drivers/media/platform/rcar_drif.c index 81413ab52475..9fa108b23cb3 100644 --- a/drivers/media/platform/rcar_drif.c +++ b/drivers/media/platform/rcar_drif.c @@ -870,8 +870,8 @@ static int rcar_drif_querycap(struct file *file, void *fh, { struct rcar_drif_sdr *sdr = video_drvdata(file); - strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); - strlcpy(cap->card, sdr->vdev->name, sizeof(cap->card)); + strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); + strscpy(cap->card, sdr->vdev->name, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", sdr->vdev->name); diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c index 2a15b7cca338..6bda1eee9170 100644 --- a/drivers/media/platform/rcar_fdp1.c +++ b/drivers/media/platform/rcar_fdp1.c @@ -1359,8 +1359,8 @@ static void device_frame_end(struct fdp1_dev *fdp1, static int fdp1_vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - strlcpy(cap->driver, DRIVER_NAME, sizeof(cap->driver)); - strlcpy(cap->card, DRIVER_NAME, sizeof(cap->card)); + strscpy(cap->driver, DRIVER_NAME, sizeof(cap->driver)); + strscpy(cap->card, DRIVER_NAME, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", DRIVER_NAME); return 0; @@ -2339,7 +2339,7 @@ static int fdp1_probe(struct platform_device *pdev) vfd->lock = &fdp1->dev_mutex; vfd->v4l2_dev = &fdp1->v4l2_dev; video_set_drvdata(vfd, fdp1); - strlcpy(vfd->name, fdp1_videodev.name, sizeof(vfd->name)); + strscpy(vfd->name, fdp1_videodev.name, sizeof(vfd->name)); ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); if (ret) { diff --git a/drivers/media/platform/rcar_jpu.c b/drivers/media/platform/rcar_jpu.c index e5c882423f57..1dfd2eb65920 100644 --- a/drivers/media/platform/rcar_jpu.c +++ b/drivers/media/platform/rcar_jpu.c @@ -664,11 +664,11 @@ static int jpu_querycap(struct file *file, void *priv, struct jpu_ctx *ctx = fh_to_ctx(priv); if (ctx->encoder) - strlcpy(cap->card, DRV_NAME " encoder", sizeof(cap->card)); + strscpy(cap->card, DRV_NAME " encoder", sizeof(cap->card)); else - strlcpy(cap->card, DRV_NAME " decoder", sizeof(cap->card)); + strscpy(cap->card, DRV_NAME " decoder", sizeof(cap->card)); - strlcpy(cap->driver, DRV_NAME, sizeof(cap->driver)); + strscpy(cap->driver, DRV_NAME, sizeof(cap->driver)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(ctx->jpu->dev)); cap->device_caps |= V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_M2M_MPLANE; @@ -1654,7 +1654,7 @@ static int jpu_probe(struct platform_device *pdev) for (i = 0; i < JPU_MAX_QUALITY; i++) jpu_generate_hdr(i, (unsigned char *)jpeg_hdrs[i]); - strlcpy(jpu->vfd_encoder.name, DRV_NAME, sizeof(jpu->vfd_encoder.name)); + strscpy(jpu->vfd_encoder.name, DRV_NAME, sizeof(jpu->vfd_encoder.name)); jpu->vfd_encoder.fops = &jpu_fops; jpu->vfd_encoder.ioctl_ops = &jpu_ioctl_ops; jpu->vfd_encoder.minor = -1; @@ -1671,7 +1671,7 @@ static int jpu_probe(struct platform_device *pdev) video_set_drvdata(&jpu->vfd_encoder, jpu); - strlcpy(jpu->vfd_decoder.name, DRV_NAME, sizeof(jpu->vfd_decoder.name)); + strscpy(jpu->vfd_decoder.name, DRV_NAME, sizeof(jpu->vfd_decoder.name)); jpu->vfd_decoder.fops = &jpu_fops; jpu->vfd_decoder.ioctl_ops = &jpu_ioctl_ops; jpu->vfd_decoder.minor = -1; diff --git a/drivers/media/platform/renesas-ceu.c b/drivers/media/platform/renesas-ceu.c index ad782901cd7a..b7ae820a2ef6 100644 --- a/drivers/media/platform/renesas-ceu.c +++ b/drivers/media/platform/renesas-ceu.c @@ -1137,8 +1137,8 @@ static int ceu_querycap(struct file *file, void *priv, { struct ceu_device *ceudev = video_drvdata(file); - strlcpy(cap->card, "Renesas CEU", sizeof(cap->card)); - strlcpy(cap->driver, DRIVER_NAME, sizeof(cap->driver)); + strscpy(cap->card, "Renesas CEU", sizeof(cap->card)); + strscpy(cap->driver, DRIVER_NAME, sizeof(cap->driver)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:renesas-ceu-%s", dev_name(ceudev->dev)); @@ -1440,7 +1440,7 @@ static int ceu_notify_complete(struct v4l2_async_notifier *notifier) return ret; /* Register the video device. */ - strlcpy(vdev->name, DRIVER_NAME, sizeof(vdev->name)); + strscpy(vdev->name, DRIVER_NAME, sizeof(vdev->name)); vdev->v4l2_dev = v4l2_dev; vdev->lock = &ceudev->mlock; vdev->queue = &ceudev->vb2_vq; diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c index ab5a6f95044a..9cc9db083870 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -447,9 +447,9 @@ static const struct v4l2_file_operations rga_fops = { static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - strlcpy(cap->driver, RGA_NAME, sizeof(cap->driver)); - strlcpy(cap->card, "rockchip-rga", sizeof(cap->card)); - strlcpy(cap->bus_info, "platform:rga", sizeof(cap->bus_info)); + strscpy(cap->driver, RGA_NAME, sizeof(cap->driver)); + strscpy(cap->card, "rockchip-rga", sizeof(cap->card)); + strscpy(cap->bus_info, "platform:rga", sizeof(cap->bus_info)); return 0; } diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c index c02dce8b4c6c..23b008d1a47b 100644 --- a/drivers/media/platform/s3c-camif/camif-capture.c +++ b/drivers/media/platform/s3c-camif/camif-capture.c @@ -640,8 +640,8 @@ static int s3c_camif_vidioc_querycap(struct file *file, void *priv, { struct camif_vp *vp = video_drvdata(file); - strlcpy(cap->driver, S3C_CAMIF_DRIVER_NAME, sizeof(cap->driver)); - strlcpy(cap->card, S3C_CAMIF_DRIVER_NAME, sizeof(cap->card)); + strscpy(cap->driver, S3C_CAMIF_DRIVER_NAME, sizeof(cap->driver)); + strscpy(cap->card, S3C_CAMIF_DRIVER_NAME, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s.%d", dev_name(vp->camif->dev), vp->id); @@ -661,7 +661,7 @@ static int s3c_camif_vidioc_enum_input(struct file *file, void *priv, return -EINVAL; input->type = V4L2_INPUT_TYPE_CAMERA; - strlcpy(input->name, sensor->name, sizeof(input->name)); + strscpy(input->name, sensor->name, sizeof(input->name)); return 0; } @@ -688,7 +688,7 @@ static int s3c_camif_vidioc_enum_fmt(struct file *file, void *priv, if (!fmt) return -EINVAL; - strlcpy(f->description, fmt->name, sizeof(f->description)); + strscpy(f->description, fmt->name, sizeof(f->description)); f->pixelformat = fmt->fourcc; pr_debug("fmt(%d): %s\n", f->index, f->description); @@ -1555,7 +1555,7 @@ int s3c_camif_create_subdev(struct camif_dev *camif) v4l2_subdev_init(sd, &s3c_camif_subdev_ops); sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; - strlcpy(sd->name, "S3C-CAMIF", sizeof(sd->name)); + strscpy(sd->name, "S3C-CAMIF", sizeof(sd->name)); camif->pads[CAMIF_SD_PAD_SINK].flags = MEDIA_PAD_FL_SINK; camif->pads[CAMIF_SD_PAD_SOURCE_C].flags = MEDIA_PAD_FL_SOURCE; diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c index 79bc0ef6bb41..31759f16458e 100644 --- a/drivers/media/platform/s3c-camif/camif-core.c +++ b/drivers/media/platform/s3c-camif/camif-core.c @@ -316,12 +316,12 @@ static int camif_media_dev_init(struct camif_dev *camif) memset(md, 0, sizeof(*md)); snprintf(md->model, sizeof(md->model), "SAMSUNG S3C%s CAMIF", ip_rev == S3C6410_CAMIF_IP_REV ? "6410" : "244X"); - strlcpy(md->bus_info, "platform", sizeof(md->bus_info)); + strscpy(md->bus_info, "platform", sizeof(md->bus_info)); md->hw_revision = ip_rev; md->dev = camif->dev; - strlcpy(v4l2_dev->name, "s3c-camif", sizeof(v4l2_dev->name)); + strscpy(v4l2_dev->name, "s3c-camif", sizeof(v4l2_dev->name)); v4l2_dev->mdev = md; media_device_init(md); diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 04fd2e0493c0..3f9000b70385 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -1276,14 +1276,14 @@ static int s5p_jpeg_querycap(struct file *file, void *priv, struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv); if (ctx->mode == S5P_JPEG_ENCODE) { - strlcpy(cap->driver, S5P_JPEG_M2M_NAME, + strscpy(cap->driver, S5P_JPEG_M2M_NAME, sizeof(cap->driver)); - strlcpy(cap->card, S5P_JPEG_M2M_NAME " encoder", + strscpy(cap->card, S5P_JPEG_M2M_NAME " encoder", sizeof(cap->card)); } else { - strlcpy(cap->driver, S5P_JPEG_M2M_NAME, + strscpy(cap->driver, S5P_JPEG_M2M_NAME, sizeof(cap->driver)); - strlcpy(cap->card, S5P_JPEG_M2M_NAME " decoder", + strscpy(cap->card, S5P_JPEG_M2M_NAME " decoder", sizeof(cap->card)); } snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", @@ -1314,7 +1314,7 @@ static int enum_fmt(struct s5p_jpeg_fmt *sjpeg_formats, int n, if (i >= n) return -EINVAL; - strlcpy(f->description, sjpeg_formats[i].name, sizeof(f->description)); + strscpy(f->description, sjpeg_formats[i].name, sizeof(f->description)); f->pixelformat = sjpeg_formats[i].fourcc; return 0; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 6a3cc4f86c5d..670ca869babb 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -271,8 +271,8 @@ static int vidioc_querycap(struct file *file, void *priv, { struct s5p_mfc_dev *dev = video_drvdata(file); - strlcpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver)); - strlcpy(cap->card, dev->vfd_dec->name, sizeof(cap->card)); + strscpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver)); + strscpy(cap->card, dev->vfd_dec->name, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(&dev->plat_dev->dev)); /* @@ -308,7 +308,7 @@ static int vidioc_enum_fmt(struct file *file, struct v4l2_fmtdesc *f, if (i == ARRAY_SIZE(formats)) return -EINVAL; fmt = &formats[i]; - strlcpy(f->description, fmt->name, sizeof(f->description)); + strscpy(f->description, fmt->name, sizeof(f->description)); f->pixelformat = fmt->fourcc; return 0; } diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 3ad4f5073002..7037d48bdc2c 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -1313,8 +1313,8 @@ static int vidioc_querycap(struct file *file, void *priv, { struct s5p_mfc_dev *dev = video_drvdata(file); - strlcpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver)); - strlcpy(cap->card, dev->vfd_enc->name, sizeof(cap->card)); + strscpy(cap->driver, S5P_MFC_NAME, sizeof(cap->driver)); + strscpy(cap->card, dev->vfd_enc->name, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(&dev->plat_dev->dev)); /* @@ -1344,7 +1344,7 @@ static int vidioc_enum_fmt(struct file *file, struct v4l2_fmtdesc *f, if (j == f->index) { fmt = &formats[i]; - strlcpy(f->description, fmt->name, + strscpy(f->description, fmt->name, sizeof(f->description)); f->pixelformat = fmt->fourcc; return 0; diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c index 1d274c64de09..09ae64a0004c 100644 --- a/drivers/media/platform/sh_veu.c +++ b/drivers/media/platform/sh_veu.c @@ -345,9 +345,9 @@ static int sh_veu_context_init(struct sh_veu_dev *veu) static int sh_veu_querycap(struct file *file, void *priv, struct v4l2_capability *cap) { - strlcpy(cap->driver, "sh-veu", sizeof(cap->driver)); - strlcpy(cap->card, "sh-mobile VEU", sizeof(cap->card)); - strlcpy(cap->bus_info, "platform:sh-veu", sizeof(cap->bus_info)); + strscpy(cap->driver, "sh-veu", sizeof(cap->driver)); + strscpy(cap->card, "sh-mobile VEU", sizeof(cap->card)); + strscpy(cap->bus_info, "platform:sh-veu", sizeof(cap->bus_info)); cap->device_caps = V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; @@ -359,7 +359,8 @@ static int sh_veu_enum_fmt(struct v4l2_fmtdesc *f, const int *fmt, int fmt_num) if (f->index >= fmt_num) return -EINVAL; - strlcpy(f->description, sh_veu_fmt[fmt[f->index]].name, sizeof(f->description)); + strscpy(f->description, sh_veu_fmt[fmt[f->index]].name, + sizeof(f->description)); f->pixelformat = sh_veu_fmt[fmt[f->index]].fourcc; return 0; } diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c index 6135e13e24d4..cee58b125548 100644 --- a/drivers/media/platform/sh_vou.c +++ b/drivers/media/platform/sh_vou.c @@ -378,9 +378,9 @@ static int sh_vou_querycap(struct file *file, void *priv, dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__); - strlcpy(cap->card, "SuperH VOU", sizeof(cap->card)); - strlcpy(cap->driver, "sh-vou", sizeof(cap->driver)); - strlcpy(cap->bus_info, "platform:sh-vou", sizeof(cap->bus_info)); + strscpy(cap->card, "SuperH VOU", sizeof(cap->card)); + strscpy(cap->driver, "sh-vou", sizeof(cap->driver)); + strscpy(cap->bus_info, "platform:sh-vou", sizeof(cap->bus_info)); cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; @@ -399,7 +399,7 @@ static int sh_vou_enum_fmt_vid_out(struct file *file, void *priv, dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__); fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - strlcpy(fmt->description, vou_fmt[fmt->index].desc, + strscpy(fmt->description, vou_fmt[fmt->index].desc, sizeof(fmt->description)); fmt->pixelformat = vou_fmt[fmt->index].pfmt; @@ -790,7 +790,7 @@ static int sh_vou_enum_output(struct file *file, void *fh, if (a->index) return -EINVAL; - strlcpy(a->name, "Video Out", sizeof(a->name)); + strscpy(a->name, "Video Out", sizeof(a->name)); a->type = V4L2_OUTPUT_TYPE_ANALOG; a->std = vou_dev->vdev.tvnorms; return 0; diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c index 0a2c0daaffef..6803f744e307 100644 --- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c +++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c @@ -1564,9 +1564,9 @@ static __poll_t sh_mobile_ceu_poll(struct file *file, poll_table *pt) static int sh_mobile_ceu_querycap(struct soc_camera_host *ici, struct v4l2_capability *cap) { - strlcpy(cap->card, "SuperH_Mobile_CEU", sizeof(cap->card)); - strlcpy(cap->driver, "sh_mobile_ceu", sizeof(cap->driver)); - strlcpy(cap->bus_info, "platform:sh_mobile_ceu", sizeof(cap->bus_info)); + strscpy(cap->card, "SuperH_Mobile_CEU", sizeof(cap->card)); + strscpy(cap->driver, "sh_mobile_ceu", sizeof(cap->driver)); + strscpy(cap->bus_info, "platform:sh_mobile_ceu", sizeof(cap->bus_info)); cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c index 66d613629167..1a00b1fa7990 100644 --- a/drivers/media/platform/soc_camera/soc_camera.c +++ b/drivers/media/platform/soc_camera/soc_camera.c @@ -874,7 +874,7 @@ static int soc_camera_enum_fmt_vid_cap(struct file *file, void *priv, format = icd->user_formats[f->index].host_fmt; if (format->name) - strlcpy(f->description, format->name, sizeof(f->description)); + strscpy(f->description, format->name, sizeof(f->description)); f->pixelformat = format->fourcc; return 0; } @@ -910,7 +910,7 @@ static int soc_camera_querycap(struct file *file, void *priv, WARN_ON(priv != file->private_data); - strlcpy(cap->driver, ici->drv_name, sizeof(cap->driver)); + strscpy(cap->driver, ici->drv_name, sizeof(cap->driver)); return ici->ops->querycap(ici, cap); } @@ -2026,7 +2026,7 @@ static int video_dev_create(struct soc_camera_device *icd) if (!vdev) return -ENOMEM; - strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name)); + strscpy(vdev->name, ici->drv_name, sizeof(vdev->name)); vdev->v4l2_dev = &ici->v4l2_dev; vdev->fops = &soc_camera_fops; diff --git a/drivers/media/platform/soc_camera/soc_camera_platform.c b/drivers/media/platform/soc_camera/soc_camera_platform.c index 6745a6e3f464..79fbe1fea95f 100644 --- a/drivers/media/platform/soc_camera/soc_camera_platform.c +++ b/drivers/media/platform/soc_camera/soc_camera_platform.c @@ -156,7 +156,7 @@ static int soc_camera_platform_probe(struct platform_device *pdev) v4l2_subdev_init(&priv->subdev, &platform_subdev_ops); v4l2_set_subdevdata(&priv->subdev, p); - strlcpy(priv->subdev.name, dev_name(&pdev->dev), + strscpy(priv->subdev.name, dev_name(&pdev->dev), sizeof(priv->subdev.name)); return v4l2_device_register_subdev(&ici->v4l2_dev, &priv->subdev); diff --git a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c index 66b64096f5de..79f7db1a9d18 100644 --- a/drivers/media/platform/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/sti/bdisp/bdisp-v4l2.c @@ -688,8 +688,8 @@ static int bdisp_querycap(struct file *file, void *fh, struct bdisp_ctx *ctx = fh_to_ctx(fh); struct bdisp_dev *bdisp = ctx->bdisp_dev; - strlcpy(cap->driver, bdisp->pdev->name, sizeof(cap->driver)); - strlcpy(cap->card, bdisp->pdev->name, sizeof(cap->card)); + strscpy(cap->driver, bdisp->pdev->name, sizeof(cap->driver)); + strscpy(cap->card, bdisp->pdev->name, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s%d", BDISP_NAME, bdisp->id); diff --git a/drivers/media/platform/sti/delta/delta-v4l2.c b/drivers/media/platform/sti/delta/delta-v4l2.c index 0b42acd4e3a6..91369fb3ffaa 100644 --- a/drivers/media/platform/sti/delta/delta-v4l2.c +++ b/drivers/media/platform/sti/delta/delta-v4l2.c @@ -385,8 +385,8 @@ static int delta_querycap(struct file *file, void *priv, struct delta_ctx *ctx = to_ctx(file->private_data); struct delta_dev *delta = ctx->dev; - strlcpy(cap->driver, DELTA_NAME, sizeof(cap->driver)); - strlcpy(cap->card, delta->vdev->name, sizeof(cap->card)); + strscpy(cap->driver, DELTA_NAME, sizeof(cap->driver)); + strscpy(cap->card, delta->vdev->name, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", delta->pdev->name); diff --git a/drivers/media/platform/sti/hva/hva-v4l2.c b/drivers/media/platform/sti/hva/hva-v4l2.c index 5a807c7c5e79..c42623dccfd6 100644 --- a/drivers/media/platform/sti/hva/hva-v4l2.c +++ b/drivers/media/platform/sti/hva/hva-v4l2.c @@ -257,8 +257,8 @@ static int hva_querycap(struct file *file, void *priv, struct hva_ctx *ctx = fh_to_ctx(file->private_data); struct hva_dev *hva = ctx_to_hdev(ctx); - strlcpy(cap->driver, HVA_NAME, sizeof(cap->driver)); - strlcpy(cap->card, hva->vdev->name, sizeof(cap->card)); + strscpy(cap->driver, HVA_NAME, sizeof(cap->driver)); + strscpy(cap->card, hva->vdev->name, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", hva->pdev->name); 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; diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c index d1febe5baa6d..c9f54fbcdfe4 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -912,8 +912,8 @@ static int cal_querycap(struct file *file, void *priv, { struct cal_ctx *ctx = video_drvdata(file); - strlcpy(cap->driver, CAL_MODULE_NAME, sizeof(cap->driver)); - strlcpy(cap->card, CAL_MODULE_NAME, sizeof(cap->card)); + strscpy(cap->driver, CAL_MODULE_NAME, sizeof(cap->driver)); + strscpy(cap->card, CAL_MODULE_NAME, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", ctx->v4l2_dev.name); @@ -1818,7 +1818,7 @@ static int cal_probe(struct platform_device *pdev) return -ENOMEM; /* set pseudo v4l2 device name so we can use v4l2_printk */ - strlcpy(dev->v4l2_dev.name, CAL_MODULE_NAME, + strscpy(dev->v4l2_dev.name, CAL_MODULE_NAME, sizeof(dev->v4l2_dev.name)); /* save pdev pointer */ diff --git a/drivers/media/platform/via-camera.c b/drivers/media/platform/via-camera.c index c8bb82fe0b9d..554870e48750 100644 --- a/drivers/media/platform/via-camera.c +++ b/drivers/media/platform/via-camera.c @@ -860,8 +860,8 @@ static int viacam_enum_fmt_vid_cap(struct file *filp, void *priv, { if (fmt->index >= N_VIA_FMTS) return -EINVAL; - strlcpy(fmt->description, via_formats[fmt->index].desc, - sizeof(fmt->description)); + strscpy(fmt->description, via_formats[fmt->index].desc, + sizeof(fmt->description)); fmt->pixelformat = via_formats[fmt->index].pixelformat; return 0; } diff --git a/drivers/media/platform/vicodec/vicodec-core.c b/drivers/media/platform/vicodec/vicodec-core.c index 11385d44e500..a044475d0469 100644 --- a/drivers/media/platform/vicodec/vicodec-core.c +++ b/drivers/media/platform/vicodec/vicodec-core.c @@ -1287,7 +1287,7 @@ static int vicodec_probe(struct platform_device *pdev) #ifdef CONFIG_MEDIA_CONTROLLER dev->mdev.dev = &pdev->dev; - strlcpy(dev->mdev.model, "vicodec", sizeof(dev->mdev.model)); + strscpy(dev->mdev.model, "vicodec", sizeof(dev->mdev.model)); media_device_init(&dev->mdev); dev->v4l2_dev.mdev = &dev->mdev; #endif @@ -1315,7 +1315,7 @@ static int vicodec_probe(struct platform_device *pdev) vfd = &dev->enc_vfd; vfd->lock = &dev->enc_mutex; vfd->v4l2_dev = &dev->v4l2_dev; - strlcpy(vfd->name, "vicodec-enc", sizeof(vfd->name)); + strscpy(vfd->name, "vicodec-enc", sizeof(vfd->name)); v4l2_disable_ioctl(vfd, VIDIOC_DECODER_CMD); v4l2_disable_ioctl(vfd, VIDIOC_TRY_DECODER_CMD); video_set_drvdata(vfd, dev); @@ -1332,7 +1332,7 @@ static int vicodec_probe(struct platform_device *pdev) vfd = &dev->dec_vfd; vfd->lock = &dev->dec_mutex; vfd->v4l2_dev = &dev->v4l2_dev; - strlcpy(vfd->name, "vicodec-dec", sizeof(vfd->name)); + strscpy(vfd->name, "vicodec-dec", sizeof(vfd->name)); v4l2_disable_ioctl(vfd, VIDIOC_ENCODER_CMD); v4l2_disable_ioctl(vfd, VIDIOC_TRY_ENCODER_CMD); video_set_drvdata(vfd, dev); diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c index 462099a141e4..60c522ee2e03 100644 --- a/drivers/media/platform/vim2m.c +++ b/drivers/media/platform/vim2m.c @@ -1038,7 +1038,7 @@ static int vim2m_probe(struct platform_device *pdev) #ifdef CONFIG_MEDIA_CONTROLLER dev->mdev.dev = &pdev->dev; - strlcpy(dev->mdev.model, "vim2m", sizeof(dev->mdev.model)); + strscpy(dev->mdev.model, "vim2m", sizeof(dev->mdev.model)); media_device_init(&dev->mdev); dev->v4l2_dev.mdev = &dev->mdev; 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); diff --git a/drivers/media/platform/vivid/vivid-osd.c b/drivers/media/platform/vivid/vivid-osd.c index bbbc1b6938a5..1a89593b0c86 100644 --- a/drivers/media/platform/vivid/vivid-osd.c +++ b/drivers/media/platform/vivid/vivid-osd.c @@ -110,7 +110,7 @@ static int vivid_fb_get_fix(struct vivid_dev *dev, struct fb_fix_screeninfo *fix { dprintk(dev, 1, "vivid_fb_get_fix\n"); memset(fix, 0, sizeof(struct fb_fix_screeninfo)); - strlcpy(fix->id, "vioverlay fb", sizeof(fix->id)); + strscpy(fix->id, "vioverlay fb", sizeof(fix->id)); fix->smem_start = dev->video_pbase; fix->smem_len = dev->video_buffer_size; fix->type = FB_TYPE_PACKED_PIXELS; diff --git a/drivers/media/platform/vivid/vivid-radio-common.c b/drivers/media/platform/vivid/vivid-radio-common.c index 7c8efe38ff5b..138c7bce68b1 100644 --- a/drivers/media/platform/vivid/vivid-radio-common.c +++ b/drivers/media/platform/vivid/vivid-radio-common.c @@ -76,10 +76,10 @@ void vivid_radio_rds_init(struct vivid_dev *dev) rds->ta = dev->radio_tx_rds_ta->cur.val; rds->tp = dev->radio_tx_rds_tp->cur.val; rds->ms = dev->radio_tx_rds_ms->cur.val; - strlcpy(rds->psname, + strscpy(rds->psname, dev->radio_tx_rds_psname->p_cur.p_char, sizeof(rds->psname)); - strlcpy(rds->radiotext, + strscpy(rds->radiotext, dev->radio_tx_rds_radiotext->p_cur.p_char + alt * 64, sizeof(rds->radiotext)); v4l2_ctrl_unlock(dev->radio_tx_rds_pi); diff --git a/drivers/media/platform/vivid/vivid-radio-rx.c b/drivers/media/platform/vivid/vivid-radio-rx.c index 1f86d7d4f72f..232cab508f48 100644 --- a/drivers/media/platform/vivid/vivid-radio-rx.c +++ b/drivers/media/platform/vivid/vivid-radio-rx.c @@ -223,7 +223,7 @@ int vivid_radio_rx_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) if (vt->index > 0) return -EINVAL; - strlcpy(vt->name, "AM/FM/SW Receiver", sizeof(vt->name)); + strscpy(vt->name, "AM/FM/SW Receiver", sizeof(vt->name)); vt->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_FREQ_BANDS | V4L2_TUNER_CAP_RDS | (dev->radio_rx_rds_controls ? diff --git a/drivers/media/platform/vivid/vivid-radio-tx.c b/drivers/media/platform/vivid/vivid-radio-tx.c index 1a3749ba5e7e..049d40b948bb 100644 --- a/drivers/media/platform/vivid/vivid-radio-tx.c +++ b/drivers/media/platform/vivid/vivid-radio-tx.c @@ -103,7 +103,7 @@ int vidioc_g_modulator(struct file *file, void *fh, struct v4l2_modulator *a) if (a->index > 0) return -EINVAL; - strlcpy(a->name, "AM/FM/SW Transmitter", sizeof(a->name)); + strscpy(a->name, "AM/FM/SW Transmitter", sizeof(a->name)); a->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_FREQ_BANDS | V4L2_TUNER_CAP_RDS | (dev->radio_tx_rds_controls ? diff --git a/drivers/media/platform/vivid/vivid-rds-gen.c b/drivers/media/platform/vivid/vivid-rds-gen.c index 39ca9a56448c..b5b104ee64c9 100644 --- a/drivers/media/platform/vivid/vivid-rds-gen.c +++ b/drivers/media/platform/vivid/vivid-rds-gen.c @@ -147,11 +147,11 @@ void vivid_rds_gen_fill(struct vivid_rds_gen *rds, unsigned freq, snprintf(rds->psname, sizeof(rds->psname), "%6d.%1d", freq / 16, ((freq & 0xf) * 10) / 16); if (alt) - strlcpy(rds->radiotext, + strscpy(rds->radiotext, " The Radio Data System can switch between different Radio Texts ", sizeof(rds->radiotext)); else - strlcpy(rds->radiotext, + strscpy(rds->radiotext, "An example of Radio Text as transmitted by the Radio Data System", sizeof(rds->radiotext)); } diff --git a/drivers/media/platform/vivid/vivid-sdr-cap.c b/drivers/media/platform/vivid/vivid-sdr-cap.c index cfb7cb4d37a8..200b789a3f21 100644 --- a/drivers/media/platform/vivid/vivid-sdr-cap.c +++ b/drivers/media/platform/vivid/vivid-sdr-cap.c @@ -396,7 +396,7 @@ int vivid_sdr_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) { switch (vt->index) { case 0: - strlcpy(vt->name, "ADC", sizeof(vt->name)); + strscpy(vt->name, "ADC", sizeof(vt->name)); vt->type = V4L2_TUNER_ADC; vt->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS; @@ -404,7 +404,7 @@ int vivid_sdr_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) vt->rangehigh = bands_adc[2].rangehigh; return 0; case 1: - strlcpy(vt->name, "RF", sizeof(vt->name)); + strscpy(vt->name, "RF", sizeof(vt->name)); vt->type = V4L2_TUNER_RF; vt->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS; diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c index 1599159f2574..f2c37e959bea 100644 --- a/drivers/media/platform/vivid/vivid-vid-cap.c +++ b/drivers/media/platform/vivid/vivid-vid-cap.c @@ -1505,7 +1505,7 @@ int vivid_video_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) break; } } - strlcpy(vt->name, "TV Tuner", sizeof(vt->name)); + strscpy(vt->name, "TV Tuner", sizeof(vt->name)); return 0; } diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index b6619c9c18bb..8c9d9d6e5632 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -242,7 +242,7 @@ static int vsp1_create_entities(struct vsp1_device *vsp1) mdev->dev = vsp1->dev; mdev->hw_revision = vsp1->version; - strlcpy(mdev->model, vsp1->info->model, sizeof(mdev->model)); + strscpy(mdev->model, vsp1->info->model, sizeof(mdev->model)); snprintf(mdev->bus_info, sizeof(mdev->bus_info), "platform:%s", dev_name(mdev->dev)); media_device_init(mdev); diff --git a/drivers/media/platform/vsp1/vsp1_histo.c b/drivers/media/platform/vsp1/vsp1_histo.c index 5e15c8ff88d9..8b01e99acd20 100644 --- a/drivers/media/platform/vsp1/vsp1_histo.c +++ b/drivers/media/platform/vsp1/vsp1_histo.c @@ -429,8 +429,8 @@ static int histo_v4l2_querycap(struct file *file, void *fh, cap->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING; - strlcpy(cap->driver, "vsp1", sizeof(cap->driver)); - strlcpy(cap->card, histo->video.name, sizeof(cap->card)); + strscpy(cap->driver, "vsp1", sizeof(cap->driver)); + strscpy(cap->card, histo->video.name, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(histo->entity.vsp1->dev)); diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index 81d47a09d7bc..aa54322dad71 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -976,8 +976,8 @@ vsp1_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap) cap->device_caps = V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_STREAMING; - strlcpy(cap->driver, "vsp1", sizeof(cap->driver)); - strlcpy(cap->card, video->video.name, sizeof(cap->card)); + strscpy(cap->driver, "vsp1", sizeof(cap->driver)); + strscpy(cap->card, video->video.name, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", dev_name(video->vsp1->dev)); diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c index d041f94be832..5d3f627516b2 100644 --- a/drivers/media/platform/xilinx/xilinx-dma.c +++ b/drivers/media/platform/xilinx/xilinx-dma.c @@ -504,8 +504,8 @@ xvip_dma_querycap(struct file *file, void *fh, struct v4l2_capability *cap) cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS | dma->xdev->v4l2_caps; - strlcpy(cap->driver, "xilinx-vipp", sizeof(cap->driver)); - strlcpy(cap->card, dma->video.name, sizeof(cap->card)); + strscpy(cap->driver, "xilinx-vipp", sizeof(cap->driver)); + strscpy(cap->card, dma->video.name, sizeof(cap->card)); snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s:%u", dma->xdev->dev->of_node->name, dma->port); @@ -527,7 +527,7 @@ xvip_dma_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc *f) return -EINVAL; f->pixelformat = dma->format.pixelformat; - strlcpy(f->description, dma->fmtinfo->description, + strscpy(f->description, dma->fmtinfo->description, sizeof(f->description)); return 0; diff --git a/drivers/media/platform/xilinx/xilinx-tpg.c b/drivers/media/platform/xilinx/xilinx-tpg.c index 9c49d1d10bee..851d20dcd550 100644 --- a/drivers/media/platform/xilinx/xilinx-tpg.c +++ b/drivers/media/platform/xilinx/xilinx-tpg.c @@ -833,7 +833,7 @@ static int xtpg_probe(struct platform_device *pdev) v4l2_subdev_init(subdev, &xtpg_ops); subdev->dev = &pdev->dev; subdev->internal_ops = &xtpg_internal_ops; - strlcpy(subdev->name, dev_name(&pdev->dev), sizeof(subdev->name)); + strscpy(subdev->name, dev_name(&pdev->dev), sizeof(subdev->name)); v4l2_set_subdevdata(subdev, xtpg); subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; subdev->entity.ops = &xtpg_media_ops; diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/platform/xilinx/xilinx-vipp.c index 6d95ec1e9a6b..5148df007c6e 100644 --- a/drivers/media/platform/xilinx/xilinx-vipp.c +++ b/drivers/media/platform/xilinx/xilinx-vipp.c @@ -578,7 +578,7 @@ static int xvip_composite_v4l2_init(struct xvip_composite_device *xdev) int ret; xdev->media_dev.dev = xdev->dev; - strlcpy(xdev->media_dev.model, "Xilinx Video Composite Device", + strscpy(xdev->media_dev.model, "Xilinx Video Composite Device", sizeof(xdev->media_dev.model)); xdev->media_dev.hw_revision = 0; |