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/xilinx | |
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/xilinx')
-rw-r--r-- | drivers/media/platform/xilinx/xilinx-dma.c | 6 | ||||
-rw-r--r-- | drivers/media/platform/xilinx/xilinx-tpg.c | 2 | ||||
-rw-r--r-- | drivers/media/platform/xilinx/xilinx-vipp.c | 2 |
3 files changed, 5 insertions, 5 deletions
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; |