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/pci/cx18 | |
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/pci/cx18')
-rw-r--r-- | drivers/media/pci/cx18/cx18-alsa-main.c | 2 | ||||
-rw-r--r-- | drivers/media/pci/cx18/cx18-alsa-pcm.c | 2 | ||||
-rw-r--r-- | drivers/media/pci/cx18/cx18-cards.c | 8 | ||||
-rw-r--r-- | drivers/media/pci/cx18/cx18-driver.c | 2 | ||||
-rw-r--r-- | drivers/media/pci/cx18/cx18-i2c.c | 2 | ||||
-rw-r--r-- | drivers/media/pci/cx18/cx18-ioctl.c | 8 |
6 files changed, 12 insertions, 12 deletions
diff --git a/drivers/media/pci/cx18/cx18-alsa-main.c b/drivers/media/pci/cx18/cx18-alsa-main.c index 93443d1457c5..687477748fdd 100644 --- a/drivers/media/pci/cx18/cx18-alsa-main.c +++ b/drivers/media/pci/cx18/cx18-alsa-main.c @@ -112,7 +112,7 @@ static int snd_cx18_card_set_names(struct snd_cx18_card *cxsc) struct snd_card *sc = cxsc->sc; /* sc->driver is used by alsa-lib's configurator: simple, unique */ - strlcpy(sc->driver, "CX23418", sizeof(sc->driver)); + strscpy(sc->driver, "CX23418", sizeof(sc->driver)); /* sc->shortname is a symlink in /proc/asound: CX18-M -> cardN */ snprintf(sc->shortname, sizeof(sc->shortname), "CX18-%d", diff --git a/drivers/media/pci/cx18/cx18-alsa-pcm.c b/drivers/media/pci/cx18/cx18-alsa-pcm.c index 4f31042a442a..3eafc27956c2 100644 --- a/drivers/media/pci/cx18/cx18-alsa-pcm.c +++ b/drivers/media/pci/cx18/cx18-alsa-pcm.c @@ -345,7 +345,7 @@ int snd_cx18_pcm_create(struct snd_cx18_card *cxsc) &snd_cx18_pcm_capture_ops); sp->info_flags = 0; sp->private_data = cxsc; - strlcpy(sp->name, cx->card_name, sizeof(sp->name)); + strscpy(sp->name, cx->card_name, sizeof(sp->name)); return 0; diff --git a/drivers/media/pci/cx18/cx18-cards.c b/drivers/media/pci/cx18/cx18-cards.c index c2cf965d639e..2dcbccfbd60d 100644 --- a/drivers/media/pci/cx18/cx18-cards.c +++ b/drivers/media/pci/cx18/cx18-cards.c @@ -602,8 +602,8 @@ int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input) if (index >= cx->nof_inputs) return -EINVAL; input->index = index; - strlcpy(input->name, input_strs[card_input->video_type - 1], - sizeof(input->name)); + strscpy(input->name, input_strs[card_input->video_type - 1], + sizeof(input->name)); input->type = (card_input->video_type == CX18_CARD_INPUT_VID_TUNER ? V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA); input->audioset = (1 << cx->nof_audio_inputs) - 1; @@ -625,8 +625,8 @@ int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *audio) memset(audio, 0, sizeof(*audio)); if (index >= cx->nof_audio_inputs) return -EINVAL; - strlcpy(audio->name, input_strs[aud_input->audio_type - 1], - sizeof(audio->name)); + strscpy(audio->name, input_strs[aud_input->audio_type - 1], + sizeof(audio->name)); audio->index = index; audio->capability = V4L2_AUDCAP_STEREO; return 0; diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index 0c389a3fb4e5..56763c4ea1a7 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c @@ -328,7 +328,7 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) if (!c) return; - strlcpy(c->name, "cx18 tveeprom tmp", sizeof(c->name)); + strscpy(c->name, "cx18 tveeprom tmp", sizeof(c->name)); c->adapter = &cx->i2c_adap[0]; c->addr = 0xa0 >> 1; diff --git a/drivers/media/pci/cx18/cx18-i2c.c b/drivers/media/pci/cx18/cx18-i2c.c index f0eb181f2b94..a89c666953f5 100644 --- a/drivers/media/pci/cx18/cx18-i2c.c +++ b/drivers/media/pci/cx18/cx18-i2c.c @@ -83,7 +83,7 @@ static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw, unsigned short addr_list[2] = { addr, I2C_CLIENT_END }; memset(&info, 0, sizeof(struct i2c_board_info)); - strlcpy(info.type, type, I2C_NAME_SIZE); + strscpy(info.type, type, I2C_NAME_SIZE); /* Our default information for ir-kbd-i2c.c to use */ switch (hw) { diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c index 80b902b12a78..854116375a7c 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.c +++ b/drivers/media/pci/cx18/cx18-ioctl.c @@ -397,8 +397,8 @@ static int cx18_querycap(struct file *file, void *fh, struct cx18_stream *s = video_drvdata(file); struct cx18 *cx = id->cx; - strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); - strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); + strscpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); + strscpy(vcap->card, cx->card_name, sizeof(vcap->card)); snprintf(vcap->bus_info, sizeof(vcap->bus_info), "PCI:%s", pci_name(cx->pci_dev)); vcap->capabilities = cx->v4l2_cap; /* capabilities */ @@ -632,9 +632,9 @@ static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) cx18_call_all(cx, tuner, g_tuner, vt); if (vt->type == V4L2_TUNER_RADIO) - strlcpy(vt->name, "cx18 Radio Tuner", sizeof(vt->name)); + strscpy(vt->name, "cx18 Radio Tuner", sizeof(vt->name)); else - strlcpy(vt->name, "cx18 TV Tuner", sizeof(vt->name)); + strscpy(vt->name, "cx18 TV Tuner", sizeof(vt->name)); return 0; } |