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/radio/radio-cadet.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/radio/radio-cadet.c')
-rw-r--r-- | drivers/media/radio/radio-cadet.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c index 5b82e63885cd..d12e07e32546 100644 --- a/drivers/media/radio/radio-cadet.c +++ b/drivers/media/radio/radio-cadet.c @@ -353,9 +353,9 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *v) { - strlcpy(v->driver, "ADS Cadet", sizeof(v->driver)); - strlcpy(v->card, "ADS Cadet", sizeof(v->card)); - strlcpy(v->bus_info, "ISA:radio-cadet", sizeof(v->bus_info)); + strscpy(v->driver, "ADS Cadet", sizeof(v->driver)); + strscpy(v->card, "ADS Cadet", sizeof(v->card)); + strscpy(v->bus_info, "ISA:radio-cadet", sizeof(v->bus_info)); v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO | V4L2_CAP_READWRITE | V4L2_CAP_RDS_CAPTURE; v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS; @@ -370,7 +370,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, if (v->index) return -EINVAL; v->type = V4L2_TUNER_RADIO; - strlcpy(v->name, "Radio", sizeof(v->name)); + strscpy(v->name, "Radio", sizeof(v->name)); v->capability = bands[0].capability | bands[1].capability; v->rangelow = bands[0].rangelow; /* 520 kHz (start of AM band) */ v->rangehigh = bands[1].rangehigh; /* 108.0 MHz (end of FM band) */ @@ -595,7 +595,7 @@ static int __init cadet_init(void) struct v4l2_ctrl_handler *hdl; int res = -ENODEV; - strlcpy(v4l2_dev->name, "cadet", sizeof(v4l2_dev->name)); + strscpy(v4l2_dev->name, "cadet", sizeof(v4l2_dev->name)); mutex_init(&dev->lock); /* If a probe was requested then probe ISAPnP first (safest) */ @@ -639,7 +639,7 @@ static int __init cadet_init(void) dev->is_fm_band = true; dev->curfreq = bands[dev->is_fm_band].rangelow; cadet_setfreq(dev, dev->curfreq); - strlcpy(dev->vdev.name, v4l2_dev->name, sizeof(dev->vdev.name)); + strscpy(dev->vdev.name, v4l2_dev->name, sizeof(dev->vdev.name)); dev->vdev.v4l2_dev = v4l2_dev; dev->vdev.fops = &cadet_fops; dev->vdev.ioctl_ops = &cadet_ioctl_ops; |