From cc1e6315e83db0e517dd9279050b88adc83a7eba Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 10 Sep 2018 16:20:42 -0400 Subject: media: replace strcpy() by strscpy() The strcpy() function is being deprecated upstream. Replace it by the safer strscpy(). Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/cx23885/cx23885-417.c | 2 +- drivers/media/pci/cx23885/cx23885-alsa.c | 4 ++-- drivers/media/pci/cx23885/cx23885-video.c | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'drivers/media/pci/cx23885') diff --git a/drivers/media/pci/cx23885/cx23885-417.c b/drivers/media/pci/cx23885/cx23885-417.c index 8579de5bb61b..3083434bb636 100644 --- a/drivers/media/pci/cx23885/cx23885-417.c +++ b/drivers/media/pci/cx23885/cx23885-417.c @@ -1280,7 +1280,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, return -EINVAL; if (0 != t->index) return -EINVAL; - strcpy(t->name, "Television"); + strscpy(t->name, "Television", sizeof(t->name)); call_all(dev, tuner, g_tuner, t); dprintk(1, "VIDIOC_G_TUNER: tuner type %d\n", t->type); diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c index db1e8ff35474..ee9d329c4038 100644 --- a/drivers/media/pci/cx23885/cx23885-alsa.c +++ b/drivers/media/pci/cx23885/cx23885-alsa.c @@ -526,7 +526,7 @@ static int snd_cx23885_pcm(struct cx23885_audio_dev *chip, int device, if (err < 0) return err; pcm->private_data = chip; - strcpy(pcm->name, name); + strscpy(pcm->name, name, sizeof(pcm->name)); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cx23885_pcm_ops); return 0; @@ -571,7 +571,7 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev) if (err < 0) goto error; - strcpy(card->driver, "CX23885"); + strscpy(card->driver, "CX23885", sizeof(card->driver)); sprintf(card->shortname, "Conexant CX23885"); sprintf(card->longname, "%s at %s", card->shortname, dev->name); diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index b5ac7a6a9a62..92d32a733f1b 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -639,7 +639,7 @@ static int vidioc_querycap(struct file *file, void *priv, struct cx23885_dev *dev = video_drvdata(file); struct video_device *vdev = video_devdata(file); - strcpy(cap->driver, "cx23885"); + strscpy(cap->driver, "cx23885", sizeof(cap->driver)); strscpy(cap->card, cx23885_boards[dev->board].name, sizeof(cap->card)); sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci)); @@ -731,7 +731,7 @@ int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i) i->index = n; i->type = V4L2_INPUT_TYPE_CAMERA; - strcpy(i->name, iname[INPUT(n)->type]); + strscpy(i->name, iname[INPUT(n)->type], sizeof(i->name)); i->std = CX23885_NORMS; if ((CX23885_VMUX_TELEVISION == INPUT(n)->type) || (CX23885_VMUX_CABLE == INPUT(n)->type)) { @@ -828,7 +828,7 @@ static int cx23885_query_audinput(struct file *file, void *priv, memset(i, 0, sizeof(*i)); i->index = n; - strcpy(i->name, iname[n]); + strscpy(i->name, iname[n], sizeof(i->name)); i->capability = V4L2_AUDCAP_STEREO; return 0; @@ -887,7 +887,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, if (0 != t->index) return -EINVAL; - strcpy(t->name, "Television"); + strscpy(t->name, "Television", sizeof(t->name)); call_all(dev, tuner, g_tuner, t); return 0; @@ -1186,7 +1186,8 @@ int cx23885_video_register(struct cx23885_dev *dev) /* Initialize VBI template */ cx23885_vbi_template = cx23885_video_template; - strcpy(cx23885_vbi_template.name, "cx23885-vbi"); + strscpy(cx23885_vbi_template.name, "cx23885-vbi", + sizeof(cx23885_vbi_template.name)); dev->tvnorm = V4L2_STD_NTSC_M; dev->fmt = format_by_fourcc(V4L2_PIX_FMT_YUYV); -- cgit v1.2.3