media: replace strcpy() by strscpy()
The strcpy() function is being deprecated upstream. Replace it by the safer strscpy(). Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
@@ -2455,7 +2455,8 @@ vpfe_get_pdata(struct platform_device *pdev)
|
||||
|
||||
/* we only support camera */
|
||||
sdinfo->inputs[0].index = i;
|
||||
strcpy(sdinfo->inputs[0].name, "Camera");
|
||||
strscpy(sdinfo->inputs[0].name, "Camera",
|
||||
sizeof(sdinfo->inputs[0].name));
|
||||
sdinfo->inputs[0].type = V4L2_INPUT_TYPE_CAMERA;
|
||||
sdinfo->inputs[0].std = V4L2_STD_ALL;
|
||||
sdinfo->inputs[0].capabilities = V4L2_IN_CAP_STD;
|
||||
|
@@ -1238,8 +1238,8 @@ static int isc_querycap(struct file *file, void *priv,
|
||||
{
|
||||
struct isc_device *isc = video_drvdata(file);
|
||||
|
||||
strcpy(cap->driver, ATMEL_ISC_NAME);
|
||||
strcpy(cap->card, "Atmel Image Sensor Controller");
|
||||
strscpy(cap->driver, ATMEL_ISC_NAME, sizeof(cap->driver));
|
||||
strscpy(cap->card, "Atmel Image Sensor Controller", sizeof(cap->card));
|
||||
snprintf(cap->bus_info, sizeof(cap->bus_info),
|
||||
"platform:%s", isc->v4l2_dev.name);
|
||||
|
||||
@@ -1393,7 +1393,7 @@ static int isc_enum_input(struct file *file, void *priv,
|
||||
|
||||
inp->type = V4L2_INPUT_TYPE_CAMERA;
|
||||
inp->std = 0;
|
||||
strcpy(inp->name, "Camera");
|
||||
strscpy(inp->name, "Camera", sizeof(inp->name));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -816,10 +816,12 @@ static int vpbe_display_enum_fmt(struct file *file, void *priv,
|
||||
fmt->index = index;
|
||||
fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
|
||||
if (index == 0) {
|
||||
strcpy(fmt->description, "YUV 4:2:2 - UYVY");
|
||||
strscpy(fmt->description, "YUV 4:2:2 - UYVY",
|
||||
sizeof(fmt->description));
|
||||
fmt->pixelformat = V4L2_PIX_FMT_UYVY;
|
||||
} else {
|
||||
strcpy(fmt->description, "Y/CbCr 4:2:0");
|
||||
strscpy(fmt->description, "Y/CbCr 4:2:0",
|
||||
sizeof(fmt->description));
|
||||
fmt->pixelformat = V4L2_PIX_FMT_NV12;
|
||||
}
|
||||
|
||||
|
@@ -616,7 +616,7 @@ struct v4l2_subdev *venc_sub_dev_init(struct v4l2_device *v4l2_dev,
|
||||
|
||||
v4l2_subdev_init(&venc->sd, &venc_ops);
|
||||
|
||||
strcpy(venc->sd.name, venc_name);
|
||||
strscpy(venc->sd.name, venc_name, sizeof(venc->sd.name));
|
||||
if (v4l2_device_register_subdev(v4l2_dev, &venc->sd) < 0) {
|
||||
v4l2_err(v4l2_dev,
|
||||
"vpbe unable to register venc sub device\n");
|
||||
|
@@ -949,11 +949,13 @@ static int vpif_enum_fmt_vid_cap(struct file *file, void *priv,
|
||||
/* Fill in the information about format */
|
||||
if (ch->vpifparams.iface.if_type == VPIF_IF_RAW_BAYER) {
|
||||
fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
strcpy(fmt->description, "Raw Mode -Bayer Pattern GrRBGb");
|
||||
strscpy(fmt->description, "Raw Mode -Bayer Pattern GrRBGb",
|
||||
sizeof(fmt->description));
|
||||
fmt->pixelformat = V4L2_PIX_FMT_SBGGR8;
|
||||
} else {
|
||||
fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
strcpy(fmt->description, "YCbCr4:2:2 Semi-Planar");
|
||||
strscpy(fmt->description, "YCbCr4:2:2 Semi-Planar",
|
||||
sizeof(fmt->description));
|
||||
fmt->pixelformat = V4L2_PIX_FMT_NV16;
|
||||
}
|
||||
return 0;
|
||||
|
@@ -602,7 +602,8 @@ static int vpif_enum_fmt_vid_out(struct file *file, void *priv,
|
||||
|
||||
/* Fill in the information about format */
|
||||
fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
|
||||
strcpy(fmt->description, "YCbCr4:2:2 YC Planar");
|
||||
strscpy(fmt->description, "YCbCr4:2:2 YC Planar",
|
||||
sizeof(fmt->description));
|
||||
fmt->pixelformat = V4L2_PIX_FMT_YUV422P;
|
||||
fmt->flags = 0;
|
||||
return 0;
|
||||
|
@@ -565,9 +565,9 @@ static const struct videobuf_queue_ops viu_video_qops = {
|
||||
static int vidioc_querycap(struct file *file, void *priv,
|
||||
struct v4l2_capability *cap)
|
||||
{
|
||||
strcpy(cap->driver, "viu");
|
||||
strcpy(cap->card, "viu");
|
||||
strcpy(cap->bus_info, "platform:viu");
|
||||
strscpy(cap->driver, "viu", sizeof(cap->driver));
|
||||
strscpy(cap->card, "viu", sizeof(cap->card));
|
||||
strscpy(cap->bus_info, "platform:viu", sizeof(cap->bus_info));
|
||||
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
|
||||
V4L2_CAP_STREAMING |
|
||||
V4L2_CAP_VIDEO_OVERLAY |
|
||||
@@ -941,7 +941,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
|
||||
|
||||
inp->type = V4L2_INPUT_TYPE_CAMERA;
|
||||
inp->std = fh->dev->vdev->tvnorms;
|
||||
strcpy(inp->name, "Camera");
|
||||
strscpy(inp->name, "Camera", sizeof(inp->name));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -341,7 +341,7 @@ static int cafe_smbus_setup(struct cafe_camera *cam)
|
||||
return -ENOMEM;
|
||||
adap->owner = THIS_MODULE;
|
||||
adap->algo = &cafe_smbus_algo;
|
||||
strcpy(adap->name, "cafe_ccic");
|
||||
strscpy(adap->name, "cafe_ccic", sizeof(adap->name));
|
||||
adap->dev.parent = &cam->pdev->dev;
|
||||
i2c_set_adapdata(adap, cam);
|
||||
ret = i2c_add_adapter(adap);
|
||||
|
@@ -1303,8 +1303,8 @@ static int mcam_vidioc_querycap(struct file *file, void *priv,
|
||||
{
|
||||
struct mcam_camera *cam = video_drvdata(file);
|
||||
|
||||
strcpy(cap->driver, "marvell_ccic");
|
||||
strcpy(cap->card, "marvell_ccic");
|
||||
strscpy(cap->driver, "marvell_ccic", sizeof(cap->driver));
|
||||
strscpy(cap->card, "marvell_ccic", sizeof(cap->card));
|
||||
strscpy(cap->bus_info, cam->bus_info, sizeof(cap->bus_info));
|
||||
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
|
||||
V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
|
||||
@@ -1421,7 +1421,7 @@ static int mcam_vidioc_enum_input(struct file *filp, void *priv,
|
||||
return -EINVAL;
|
||||
|
||||
input->type = V4L2_INPUT_TYPE_CAMERA;
|
||||
strcpy(input->name, "Camera");
|
||||
strscpy(input->name, "Camera", sizeof(input->name));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -312,7 +312,7 @@ static int soc_camera_enum_input(struct file *file, void *priv,
|
||||
/* default is camera */
|
||||
inp->type = V4L2_INPUT_TYPE_CAMERA;
|
||||
inp->std = icd->vdev->tvnorms;
|
||||
strcpy(inp->name, "Camera");
|
||||
strscpy(inp->name, "Camera", sizeof(inp->name));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -812,7 +812,7 @@ static int viacam_enum_input(struct file *filp, void *priv,
|
||||
|
||||
input->type = V4L2_INPUT_TYPE_CAMERA;
|
||||
input->std = V4L2_STD_ALL; /* Not sure what should go here */
|
||||
strcpy(input->name, "Camera");
|
||||
strscpy(input->name, "Camera", sizeof(input->name));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -990,8 +990,8 @@ out:
|
||||
static int viacam_querycap(struct file *filp, void *priv,
|
||||
struct v4l2_capability *cap)
|
||||
{
|
||||
strcpy(cap->driver, "via-camera");
|
||||
strcpy(cap->card, "via-camera");
|
||||
strscpy(cap->driver, "via-camera", sizeof(cap->driver));
|
||||
strscpy(cap->card, "via-camera", sizeof(cap->card));
|
||||
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
|
||||
V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
|
||||
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
|
||||
|
@@ -241,11 +241,11 @@ static int vivid_received(struct cec_adapter *adap, struct cec_msg *msg)
|
||||
cec_ops_set_osd_string(msg, &disp_ctl, osd);
|
||||
switch (disp_ctl) {
|
||||
case CEC_OP_DISP_CTL_DEFAULT:
|
||||
strcpy(dev->osd, osd);
|
||||
strscpy(dev->osd, osd, sizeof(dev->osd));
|
||||
dev->osd_jiffies = jiffies;
|
||||
break;
|
||||
case CEC_OP_DISP_CTL_UNTIL_CLEARED:
|
||||
strcpy(dev->osd, osd);
|
||||
strscpy(dev->osd, osd, sizeof(dev->osd));
|
||||
dev->osd_jiffies = 0;
|
||||
break;
|
||||
case CEC_OP_DISP_CTL_CLEAR:
|
||||
|
@@ -197,8 +197,8 @@ static int vidioc_querycap(struct file *file, void *priv,
|
||||
{
|
||||
struct vivid_dev *dev = video_drvdata(file);
|
||||
|
||||
strcpy(cap->driver, "vivid");
|
||||
strcpy(cap->card, "vivid");
|
||||
strscpy(cap->driver, "vivid", sizeof(cap->driver));
|
||||
strscpy(cap->card, "vivid", sizeof(cap->card));
|
||||
snprintf(cap->bus_info, sizeof(cap->bus_info),
|
||||
"platform:%s", dev->v4l2_dev.name);
|
||||
|
||||
|
مرجع در شماره جدید
Block a user