summaryrefslogtreecommitdiff
path: root/drivers/media/usb/s2255
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-10 15:19:14 +0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-11 20:32:17 +0300
commitc0decac19da3906d9b66291e57b7759489e1170f (patch)
tree0eeb1f7d2c5464e0c87e0c788fd8fb581662c621 /drivers/media/usb/s2255
parentb730c40813a95ebc35757790a990794f55e2b61c (diff)
downloadlinux-c0decac19da3906d9b66291e57b7759489e1170f.tar.xz
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/usb/s2255')
-rw-r--r--drivers/media/usb/s2255/s2255drv.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c
index 82927eb334c4..5b3e54b76e9a 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -730,8 +730,8 @@ static int vidioc_querycap(struct file *file, void *priv,
struct s2255_vc *vc = video_drvdata(file);
struct s2255_dev *dev = vc->dev;
- strlcpy(cap->driver, "s2255", sizeof(cap->driver));
- strlcpy(cap->card, "s2255", sizeof(cap->card));
+ strscpy(cap->driver, "s2255", sizeof(cap->driver));
+ strscpy(cap->card, "s2255", sizeof(cap->card));
usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
V4L2_CAP_READWRITE;
@@ -749,7 +749,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
if (!jpeg_enable && ((formats[index].fourcc == V4L2_PIX_FMT_JPEG) ||
(formats[index].fourcc == V4L2_PIX_FMT_MJPEG)))
return -EINVAL;
- strlcpy(f->description, formats[index].name, sizeof(f->description));
+ strscpy(f->description, formats[index].name, sizeof(f->description));
f->pixelformat = formats[index].fourcc;
return 0;
}
@@ -1195,10 +1195,10 @@ static int vidioc_enum_input(struct file *file, void *priv,
switch (dev->pid) {
case 0x2255:
default:
- strlcpy(inp->name, "Composite", sizeof(inp->name));
+ strscpy(inp->name, "Composite", sizeof(inp->name));
break;
case 0x2257:
- strlcpy(inp->name, (vc->idx < 2) ? "Composite" : "S-Video",
+ strscpy(inp->name, (vc->idx < 2) ? "Composite" : "S-Video",
sizeof(inp->name));
break;
}