diff options
author | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-10 08:19:14 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-11 13:32:17 -0400 |
commit | c0decac19da3906d9b66291e57b7759489e1170f (patch) | |
tree | 0eeb1f7d2c5464e0c87e0c788fd8fb581662c621 /drivers/media/radio/radio-tea5777.c | |
parent | b730c40813a95ebc35757790a990794f55e2b61c (diff) |
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-tea5777.c')
-rw-r--r-- | drivers/media/radio/radio-tea5777.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/radio/radio-tea5777.c b/drivers/media/radio/radio-tea5777.c index 04ed1a5d1177..61f751cf1aa4 100644 --- a/drivers/media/radio/radio-tea5777.c +++ b/drivers/media/radio/radio-tea5777.c @@ -266,10 +266,10 @@ static int vidioc_querycap(struct file *file, void *priv, { struct radio_tea5777 *tea = video_drvdata(file); - strlcpy(v->driver, tea->v4l2_dev->name, sizeof(v->driver)); - strlcpy(v->card, tea->card, sizeof(v->card)); + strscpy(v->driver, tea->v4l2_dev->name, sizeof(v->driver)); + strscpy(v->card, tea->card, sizeof(v->card)); strlcat(v->card, " TEA5777", sizeof(v->card)); - strlcpy(v->bus_info, tea->bus_info, sizeof(v->bus_info)); + strscpy(v->bus_info, tea->bus_info, sizeof(v->bus_info)); v->device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO; v->device_caps |= V4L2_CAP_HW_FREQ_SEEK; v->capabilities = v->device_caps | V4L2_CAP_DEVICE_CAPS; @@ -304,9 +304,9 @@ static int vidioc_g_tuner(struct file *file, void *priv, memset(v, 0, sizeof(*v)); if (tea->has_am) - strlcpy(v->name, "AM/FM", sizeof(v->name)); + strscpy(v->name, "AM/FM", sizeof(v->name)); else - strlcpy(v->name, "FM", sizeof(v->name)); + strscpy(v->name, "FM", sizeof(v->name)); v->type = V4L2_TUNER_RADIO; v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_FREQ_BANDS | @@ -560,7 +560,7 @@ int radio_tea5777_init(struct radio_tea5777 *tea, struct module *owner) tea->vd = tea575x_radio; video_set_drvdata(&tea->vd, tea); mutex_init(&tea->mutex); - strlcpy(tea->vd.name, tea->v4l2_dev->name, sizeof(tea->vd.name)); + strscpy(tea->vd.name, tea->v4l2_dev->name, sizeof(tea->vd.name)); tea->vd.lock = &tea->mutex; tea->vd.v4l2_dev = tea->v4l2_dev; tea->fops = tea575x_fops; |