Merge tag 'media/v4.20-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[linux-2.6-block.git] / drivers / media / usb / cx231xx / cx231xx-video.c
index 2dedb18f63a0a7a5e9c0c970c19ed19bb66bb2e1..c990f70c0ea646453d9b3bf058df201f442a83fe 100644 (file)
@@ -1169,7 +1169,7 @@ int cx231xx_enum_input(struct file *file, void *priv,
        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));
 
        if ((CX231XX_VMUX_TELEVISION == INPUT(n)->type) ||
            (CX231XX_VMUX_CABLE == INPUT(n)->type))
@@ -1244,7 +1244,7 @@ int cx231xx_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
        if (0 != t->index)
                return -EINVAL;
 
-       strcpy(t->name, "Tuner");
+       strscpy(t->name, "Tuner", sizeof(t->name));
 
        t->type = V4L2_TUNER_ANALOG_TV;
        t->capability = V4L2_TUNER_CAP_NORM;
@@ -1354,22 +1354,22 @@ int cx231xx_g_chip_info(struct file *file, void *fh,
        case 0: /* Cx231xx - internal registers */
                return 0;
        case 1: /* AFE - read byte */
-               strlcpy(chip->name, "AFE (byte)", sizeof(chip->name));
+               strscpy(chip->name, "AFE (byte)", sizeof(chip->name));
                return 0;
        case 2: /* Video Block - read byte */
-               strlcpy(chip->name, "Video (byte)", sizeof(chip->name));
+               strscpy(chip->name, "Video (byte)", sizeof(chip->name));
                return 0;
        case 3: /* I2S block - read byte */
-               strlcpy(chip->name, "I2S (byte)", sizeof(chip->name));
+               strscpy(chip->name, "I2S (byte)", sizeof(chip->name));
                return 0;
        case 4: /* AFE - read dword */
-               strlcpy(chip->name, "AFE (dword)", sizeof(chip->name));
+               strscpy(chip->name, "AFE (dword)", sizeof(chip->name));
                return 0;
        case 5: /* Video Block - read dword */
-               strlcpy(chip->name, "Video (dword)", sizeof(chip->name));
+               strscpy(chip->name, "Video (dword)", sizeof(chip->name));
                return 0;
        case 6: /* I2S Block - read dword */
-               strlcpy(chip->name, "I2S (dword)", sizeof(chip->name));
+               strscpy(chip->name, "I2S (dword)", sizeof(chip->name));
                return 0;
        }
        return -EINVAL;
@@ -1389,7 +1389,7 @@ int cx231xx_g_register(struct file *file, void *priv,
                ret = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER,
                                (u16)reg->reg, value, 4);
                reg->val = value[0] | value[1] << 8 |
-                       value[2] << 16 | value[3] << 24;
+                       value[2] << 16 | (u32)value[3] << 24;
                reg->size = 4;
                break;
        case 1: /* AFE - read byte */
@@ -1553,8 +1553,8 @@ int cx231xx_querycap(struct file *file, void *priv,
        struct cx231xx_fh *fh = priv;
        struct cx231xx *dev = fh->dev;
 
-       strlcpy(cap->driver, "cx231xx", sizeof(cap->driver));
-       strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card));
+       strscpy(cap->driver, "cx231xx", sizeof(cap->driver));
+       strscpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card));
        usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
 
        if (vdev->vfl_type == VFL_TYPE_RADIO)
@@ -1583,7 +1583,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
        if (unlikely(f->index >= ARRAY_SIZE(format)))
                return -EINVAL;
 
-       strlcpy(f->description, format[f->index].name, sizeof(f->description));
+       strscpy(f->description, format[f->index].name, sizeof(f->description));
        f->pixelformat = format[f->index].fourcc;
 
        return 0;
@@ -1716,7 +1716,7 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
        if (t->index)
                return -EINVAL;
 
-       strcpy(t->name, "Radio");
+       strscpy(t->name, "Radio", sizeof(t->name));
 
        call_all(dev, tuner, g_tuner, t);
 
@@ -2242,7 +2242,8 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
 
        /* Initialize VBI template */
        cx231xx_vbi_template = cx231xx_video_template;
-       strcpy(cx231xx_vbi_template.name, "cx231xx-vbi");
+       strscpy(cx231xx_vbi_template.name, "cx231xx-vbi",
+               sizeof(cx231xx_vbi_template.name));
 
        /* Allocate and fill vbi video_device struct */
        cx231xx_vdev_init(dev, &dev->vbi_dev, &cx231xx_vbi_template, "vbi");