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/usb/usbvision/usbvision-video.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'drivers/media/usb/usbvision') diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c index f4e758e5f3ec..dd2ff8ed6c6a 100644 --- a/drivers/media/usb/usbvision/usbvision-video.c +++ b/drivers/media/usb/usbvision/usbvision-video.c @@ -504,9 +504,9 @@ static int vidioc_enum_input(struct file *file, void *priv, switch (chan) { case 0: if (usbvision_device_data[usbvision->dev_model].video_channels == 4) { - strcpy(vi->name, "White Video Input"); + strscpy(vi->name, "White Video Input", sizeof(vi->name)); } else { - strcpy(vi->name, "Television"); + strscpy(vi->name, "Television", sizeof(vi->name)); vi->type = V4L2_INPUT_TYPE_TUNER; vi->tuner = chan; vi->std = USBVISION_NORMS; @@ -515,22 +515,23 @@ static int vidioc_enum_input(struct file *file, void *priv, case 1: vi->type = V4L2_INPUT_TYPE_CAMERA; if (usbvision_device_data[usbvision->dev_model].video_channels == 4) - strcpy(vi->name, "Green Video Input"); + strscpy(vi->name, "Green Video Input", sizeof(vi->name)); else - strcpy(vi->name, "Composite Video Input"); + strscpy(vi->name, "Composite Video Input", + sizeof(vi->name)); vi->std = USBVISION_NORMS; break; case 2: vi->type = V4L2_INPUT_TYPE_CAMERA; if (usbvision_device_data[usbvision->dev_model].video_channels == 4) - strcpy(vi->name, "Yellow Video Input"); + strscpy(vi->name, "Yellow Video Input", sizeof(vi->name)); else - strcpy(vi->name, "S-Video Input"); + strscpy(vi->name, "S-Video Input", sizeof(vi->name)); vi->std = USBVISION_NORMS; break; case 3: vi->type = V4L2_INPUT_TYPE_CAMERA; - strcpy(vi->name, "Red Video Input"); + strscpy(vi->name, "Red Video Input", sizeof(vi->name)); vi->std = USBVISION_NORMS; break; } @@ -589,9 +590,9 @@ static int vidioc_g_tuner(struct file *file, void *priv, if (vt->index) /* Only tuner 0 */ return -EINVAL; if (vt->type == V4L2_TUNER_RADIO) - strcpy(vt->name, "Radio"); + strscpy(vt->name, "Radio", sizeof(vt->name)); else - strcpy(vt->name, "Television"); + strscpy(vt->name, "Television", sizeof(vt->name)); /* Let clients fill in the remainder of this struct */ call_all(usbvision, tuner, g_tuner, vt); @@ -814,7 +815,8 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, { if (vfd->index >= USBVISION_SUPPORTED_PALETTES - 1) return -EINVAL; - strcpy(vfd->description, usbvision_v4l2_format[vfd->index].desc); + strscpy(vfd->description, usbvision_v4l2_format[vfd->index].desc, + sizeof(vfd->description)); vfd->pixelformat = usbvision_v4l2_format[vfd->index].format; return 0; } -- cgit v1.2.3