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/usb/cx231xx/cx231xx-video.c | |
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/usb/cx231xx/cx231xx-video.c')
-rw-r--r-- | drivers/media/usb/cx231xx/cx231xx-video.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index f7fcd733a2ca..7759bc66f18c 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -1354,22 +1354,22 @@ int cx231xx_g_chip_info(struct file *file, void *fh, case 0: /* Cx231xx - internal registers */ return 0; case 1: /* AFE - read byte */ - strlcpy(chip->name, "AFE (byte)", sizeof(chip->name)); + strscpy(chip->name, "AFE (byte)", sizeof(chip->name)); return 0; case 2: /* Video Block - read byte */ - strlcpy(chip->name, "Video (byte)", sizeof(chip->name)); + strscpy(chip->name, "Video (byte)", sizeof(chip->name)); return 0; case 3: /* I2S block - read byte */ - strlcpy(chip->name, "I2S (byte)", sizeof(chip->name)); + strscpy(chip->name, "I2S (byte)", sizeof(chip->name)); return 0; case 4: /* AFE - read dword */ - strlcpy(chip->name, "AFE (dword)", sizeof(chip->name)); + strscpy(chip->name, "AFE (dword)", sizeof(chip->name)); return 0; case 5: /* Video Block - read dword */ - strlcpy(chip->name, "Video (dword)", sizeof(chip->name)); + strscpy(chip->name, "Video (dword)", sizeof(chip->name)); return 0; case 6: /* I2S Block - read dword */ - strlcpy(chip->name, "I2S (dword)", sizeof(chip->name)); + strscpy(chip->name, "I2S (dword)", sizeof(chip->name)); return 0; } return -EINVAL; @@ -1553,8 +1553,8 @@ int cx231xx_querycap(struct file *file, void *priv, struct cx231xx_fh *fh = priv; struct cx231xx *dev = fh->dev; - strlcpy(cap->driver, "cx231xx", sizeof(cap->driver)); - strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card)); + strscpy(cap->driver, "cx231xx", sizeof(cap->driver)); + strscpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card)); usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); if (vdev->vfl_type == VFL_TYPE_RADIO) @@ -1583,7 +1583,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, if (unlikely(f->index >= ARRAY_SIZE(format))) return -EINVAL; - strlcpy(f->description, format[f->index].name, sizeof(f->description)); + strscpy(f->description, format[f->index].name, sizeof(f->description)); f->pixelformat = format[f->index].fourcc; return 0; |