mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 02:19:51 +00:00
media: replace strncpy() by strscpy()
The strncpy() function is being deprecated upstream. Replace it by the safer strscpy(). While here, replace a few occurences of strlcpy() that were recently added to also use strscpy(). Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
060162c1af
commit
85709cbf15
35 changed files with 70 additions and 68 deletions
|
@ -467,7 +467,7 @@ struct dvb_frontend *as102_attach(const char *name,
|
|||
|
||||
/* init frontend callback ops */
|
||||
memcpy(&fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops));
|
||||
strncpy(fe->ops.info.name, name, sizeof(fe->ops.info.name));
|
||||
strscpy(fe->ops.info.name, name, sizeof(fe->ops.info.name));
|
||||
|
||||
return fe;
|
||||
|
||||
|
|
|
@ -2774,7 +2774,8 @@ static struct dvb_frontend *dib7000p_init(struct i2c_adapter *i2c_adap, u8 i2c_a
|
|||
dibx000_init_i2c_master(&st->i2c_master, DIB7000P, st->i2c_adap, st->i2c_addr);
|
||||
|
||||
/* init 7090 tuner adapter */
|
||||
strncpy(st->dib7090_tuner_adap.name, "DiB7090 tuner interface", sizeof(st->dib7090_tuner_adap.name));
|
||||
strscpy(st->dib7090_tuner_adap.name, "DiB7090 tuner interface",
|
||||
sizeof(st->dib7090_tuner_adap.name));
|
||||
st->dib7090_tuner_adap.algo = &dib7090_tuner_xfer_algo;
|
||||
st->dib7090_tuner_adap.algo_data = NULL;
|
||||
st->dib7090_tuner_adap.dev.parent = st->i2c_adap->dev.parent;
|
||||
|
|
|
@ -4458,8 +4458,8 @@ static struct dvb_frontend *dib8000_init(struct i2c_adapter *i2c_adap, u8 i2c_ad
|
|||
dibx000_init_i2c_master(&state->i2c_master, DIB8000, state->i2c.adap, state->i2c.addr);
|
||||
|
||||
/* init 8096p tuner adapter */
|
||||
strncpy(state->dib8096p_tuner_adap.name, "DiB8096P tuner interface",
|
||||
sizeof(state->dib8096p_tuner_adap.name));
|
||||
strscpy(state->dib8096p_tuner_adap.name, "DiB8096P tuner interface",
|
||||
sizeof(state->dib8096p_tuner_adap.name));
|
||||
state->dib8096p_tuner_adap.algo = &dib8096p_tuner_xfer_algo;
|
||||
state->dib8096p_tuner_adap.algo_data = NULL;
|
||||
state->dib8096p_tuner_adap.dev.parent = state->i2c.adap->dev.parent;
|
||||
|
|
|
@ -2521,7 +2521,8 @@ struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, c
|
|||
dibx000_init_i2c_master(&st->i2c_master, DIB7000MC, st->i2c.i2c_adap, st->i2c.i2c_addr);
|
||||
|
||||
st->tuner_adap.dev.parent = i2c_adap->dev.parent;
|
||||
strncpy(st->tuner_adap.name, "DIB9000_FW TUNER ACCESS", sizeof(st->tuner_adap.name));
|
||||
strscpy(st->tuner_adap.name, "DIB9000_FW TUNER ACCESS",
|
||||
sizeof(st->tuner_adap.name));
|
||||
st->tuner_adap.algo = &dib9000_tuner_algo;
|
||||
st->tuner_adap.algo_data = NULL;
|
||||
i2c_set_adapdata(&st->tuner_adap, st);
|
||||
|
@ -2529,7 +2530,8 @@ struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, c
|
|||
goto error;
|
||||
|
||||
st->component_bus.dev.parent = i2c_adap->dev.parent;
|
||||
strncpy(st->component_bus.name, "DIB9000_FW COMPONENT BUS ACCESS", sizeof(st->component_bus.name));
|
||||
strscpy(st->component_bus.name, "DIB9000_FW COMPONENT BUS ACCESS",
|
||||
sizeof(st->component_bus.name));
|
||||
st->component_bus.algo = &dib9000_component_bus_algo;
|
||||
st->component_bus.algo_data = NULL;
|
||||
st->component_bus_speed = 340;
|
||||
|
|
|
@ -839,7 +839,7 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr,
|
|||
memcpy(&fe->ops.tuner_ops, &dvb_pll_tuner_ops,
|
||||
sizeof(struct dvb_tuner_ops));
|
||||
|
||||
strncpy(fe->ops.tuner_ops.info.name, desc->name,
|
||||
strscpy(fe->ops.tuner_ops.info.name, desc->name,
|
||||
sizeof(fe->ops.tuner_ops.info.name));
|
||||
|
||||
fe->ops.tuner_ops.info.frequency_min_hz = desc->min;
|
||||
|
|
|
@ -1469,7 +1469,7 @@ static int m88ds3103_probe(struct i2c_client *client,
|
|||
/* create dvb_frontend */
|
||||
memcpy(&dev->fe.ops, &m88ds3103_ops, sizeof(struct dvb_frontend_ops));
|
||||
if (dev->chip_id == M88RS6000_CHIP_ID)
|
||||
strncpy(dev->fe.ops.info.name, "Montage Technology M88RS6000",
|
||||
strscpy(dev->fe.ops.info.name, "Montage Technology M88RS6000",
|
||||
sizeof(dev->fe.ops.info.name));
|
||||
if (!pdata->attach_in_use)
|
||||
dev->fe.ops.release = NULL;
|
||||
|
|
|
@ -1100,7 +1100,8 @@ static int dst_get_device_id(struct dst_state *state)
|
|||
/* Card capabilities */
|
||||
state->dst_hw_cap = p_dst_type->dst_feature;
|
||||
pr_err("Recognise [%s]\n", p_dst_type->device_id);
|
||||
strncpy(&state->fw_name[0], p_dst_type->device_id, 6);
|
||||
strscpy((char *)state->fw_name, p_dst_type->device_id,
|
||||
sizeof(state->fw_name));
|
||||
/* Multiple tuners */
|
||||
if (p_dst_type->tuner_type & TUNER_TYPE_MULTI) {
|
||||
switch (use_dst_type) {
|
||||
|
|
|
@ -225,7 +225,7 @@ int mantis_i2c_init(struct mantis_pci *mantis)
|
|||
|
||||
init_waitqueue_head(&mantis->i2c_wq);
|
||||
mutex_init(&mantis->i2c_lock);
|
||||
strncpy(i2c_adapter->name, "Mantis I2C", sizeof(i2c_adapter->name));
|
||||
strscpy(i2c_adapter->name, "Mantis I2C", sizeof(i2c_adapter->name));
|
||||
i2c_set_adapdata(i2c_adapter, mantis);
|
||||
|
||||
i2c_adapter->owner = THIS_MODULE;
|
||||
|
|
|
@ -444,7 +444,7 @@ static int saa7134_go7007_init(struct saa7134_dev *dev)
|
|||
sd = &saa->sd;
|
||||
v4l2_subdev_init(sd, &saa7134_go7007_sd_ops);
|
||||
v4l2_set_subdevdata(sd, saa);
|
||||
strncpy(sd->name, "saa7134-go7007", sizeof(sd->name));
|
||||
strscpy(sd->name, "saa7134-go7007", sizeof(sd->name));
|
||||
|
||||
/* Allocate a couple pages for receiving the compressed stream */
|
||||
saa->top = (u8 *)get_zeroed_page(GFP_KERNEL);
|
||||
|
|
|
@ -1540,7 +1540,7 @@ static int vpfe_enum_fmt(struct file *file, void *priv,
|
|||
if (!fmt)
|
||||
return -EINVAL;
|
||||
|
||||
strncpy(f->description, fmt->name, sizeof(f->description) - 1);
|
||||
strscpy(f->description, fmt->name, sizeof(f->description));
|
||||
f->pixelformat = fmt->fourcc;
|
||||
f->type = vpfe->fmt.type;
|
||||
|
||||
|
|
|
@ -1759,7 +1759,7 @@ static int vpfe_probe(struct platform_device *pdev)
|
|||
|
||||
mutex_lock(&ccdc_lock);
|
||||
|
||||
strncpy(ccdc_cfg->name, vpfe_cfg->ccdc, 32);
|
||||
strscpy(ccdc_cfg->name, vpfe_cfg->ccdc, sizeof(ccdc_cfg->name));
|
||||
/* Get VINT0 irq resource */
|
||||
res1 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
||||
if (!res1) {
|
||||
|
|
|
@ -1254,7 +1254,8 @@ static int vpif_s_dv_timings(struct file *file, void *priv,
|
|||
} else {
|
||||
std_info->l5 = std_info->vsize - (bt->vfrontporch - 1);
|
||||
}
|
||||
strncpy(std_info->name, "Custom timings BT656/1120", VPIF_MAX_NAME);
|
||||
strscpy(std_info->name, "Custom timings BT656/1120",
|
||||
sizeof(std_info->name));
|
||||
std_info->width = bt->width;
|
||||
std_info->height = bt->height;
|
||||
std_info->frm_fmt = bt->interlaced ? 0 : 1;
|
||||
|
|
|
@ -987,8 +987,8 @@ static int vpif_s_dv_timings(struct file *file, void *priv,
|
|||
} else {
|
||||
std_info->l5 = std_info->vsize - (bt->vfrontporch - 1);
|
||||
}
|
||||
strncpy(std_info->name, "Custom timings BT656/1120",
|
||||
VPIF_MAX_NAME);
|
||||
strscpy(std_info->name, "Custom timings BT656/1120",
|
||||
sizeof(std_info->name));
|
||||
std_info->width = bt->width;
|
||||
std_info->height = bt->height;
|
||||
std_info->frm_fmt = bt->interlaced ? 0 : 1;
|
||||
|
|
|
@ -742,7 +742,7 @@ static int fimc_cap_enum_fmt_mplane(struct file *file, void *priv,
|
|||
f->index);
|
||||
if (!fmt)
|
||||
return -EINVAL;
|
||||
strncpy(f->description, fmt->name, sizeof(f->description) - 1);
|
||||
strscpy(f->description, fmt->name, sizeof(f->description));
|
||||
f->pixelformat = fmt->fourcc;
|
||||
if (fmt->fourcc == MEDIA_BUS_FMT_JPEG_1X8)
|
||||
f->flags |= V4L2_FMT_FLAG_COMPRESSED;
|
||||
|
|
|
@ -252,7 +252,7 @@ static int fimc_m2m_enum_fmt_mplane(struct file *file, void *priv,
|
|||
if (!fmt)
|
||||
return -EINVAL;
|
||||
|
||||
strncpy(f->description, fmt->name, sizeof(f->description) - 1);
|
||||
strscpy(f->description, fmt->name, sizeof(f->description));
|
||||
f->pixelformat = fmt->fourcc;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1025,8 +1025,8 @@ static irqreturn_t pxp_irq_handler(int irq, void *dev_id)
|
|||
static int pxp_querycap(struct file *file, void *priv,
|
||||
struct v4l2_capability *cap)
|
||||
{
|
||||
strlcpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver));
|
||||
strlcpy(cap->card, MEM2MEM_NAME, sizeof(cap->card));
|
||||
strscpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver));
|
||||
strscpy(cap->card, MEM2MEM_NAME, sizeof(cap->card));
|
||||
snprintf(cap->bus_info, sizeof(cap->bus_info),
|
||||
"platform:%s", MEM2MEM_NAME);
|
||||
return 0;
|
||||
|
|
|
@ -614,7 +614,7 @@ static void vpu_init_ipi_handler(void *data, unsigned int len, void *priv)
|
|||
struct vpu_run *run = (struct vpu_run *)data;
|
||||
|
||||
vpu->run.signaled = run->signaled;
|
||||
strncpy(vpu->run.fw_ver, run->fw_ver, VPU_FW_VER_LEN);
|
||||
strscpy(vpu->run.fw_ver, run->fw_ver, sizeof(vpu->run.fw_ver));
|
||||
vpu->run.dec_capability = run->dec_capability;
|
||||
vpu->run.enc_capability = run->enc_capability;
|
||||
wake_up_interruptible(&vpu->run.wq);
|
||||
|
|
|
@ -385,8 +385,8 @@ static irqreturn_t emmaprp_irq(int irq_emma, void *data)
|
|||
static int vidioc_querycap(struct file *file, void *priv,
|
||||
struct v4l2_capability *cap)
|
||||
{
|
||||
strncpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver) - 1);
|
||||
strncpy(cap->card, MEM2MEM_NAME, sizeof(cap->card) - 1);
|
||||
strscpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver));
|
||||
strscpy(cap->card, MEM2MEM_NAME, sizeof(cap->card));
|
||||
cap->device_caps = V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING;
|
||||
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
|
||||
return 0;
|
||||
|
|
|
@ -297,8 +297,8 @@ static int g2d_release(struct file *file)
|
|||
static int vidioc_querycap(struct file *file, void *priv,
|
||||
struct v4l2_capability *cap)
|
||||
{
|
||||
strncpy(cap->driver, G2D_NAME, sizeof(cap->driver) - 1);
|
||||
strncpy(cap->card, G2D_NAME, sizeof(cap->card) - 1);
|
||||
strscpy(cap->driver, G2D_NAME, sizeof(cap->driver));
|
||||
strscpy(cap->card, G2D_NAME, sizeof(cap->card));
|
||||
cap->bus_info[0] = 0;
|
||||
cap->device_caps = V4L2_CAP_VIDEO_M2M | V4L2_CAP_STREAMING;
|
||||
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
|
||||
|
@ -312,7 +312,7 @@ static int vidioc_enum_fmt(struct file *file, void *prv, struct v4l2_fmtdesc *f)
|
|||
return -EINVAL;
|
||||
fmt = &formats[f->index];
|
||||
f->pixelformat = fmt->fourcc;
|
||||
strncpy(f->description, fmt->name, sizeof(f->description) - 1);
|
||||
strscpy(f->description, fmt->name, sizeof(f->description));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -412,7 +412,7 @@ static int vidioc_enum_input(struct file *file, void *fh,
|
|||
if (inp->index != 0)
|
||||
return -EINVAL;
|
||||
|
||||
strlcpy(inp->name, "camera", sizeof(inp->name));
|
||||
strscpy(inp->name, "camera", sizeof(inp->name));
|
||||
inp->type = V4L2_INPUT_TYPE_CAMERA;
|
||||
|
||||
return 0;
|
||||
|
@ -644,7 +644,7 @@ int sun6i_video_init(struct sun6i_video *video, struct sun6i_csi *csi,
|
|||
}
|
||||
|
||||
/* Register video device */
|
||||
strlcpy(vdev->name, name, sizeof(vdev->name));
|
||||
strscpy(vdev->name, name, sizeof(vdev->name));
|
||||
vdev->release = video_device_release_empty;
|
||||
vdev->fops = &sun6i_video_fops;
|
||||
vdev->ioctl_ops = &sun6i_video_ioctl_ops;
|
||||
|
|
|
@ -1491,8 +1491,8 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data)
|
|||
static int vpe_querycap(struct file *file, void *priv,
|
||||
struct v4l2_capability *cap)
|
||||
{
|
||||
strncpy(cap->driver, VPE_MODULE_NAME, sizeof(cap->driver) - 1);
|
||||
strncpy(cap->card, VPE_MODULE_NAME, sizeof(cap->card) - 1);
|
||||
strscpy(cap->driver, VPE_MODULE_NAME, sizeof(cap->driver));
|
||||
strscpy(cap->card, VPE_MODULE_NAME, sizeof(cap->card));
|
||||
snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
|
||||
VPE_MODULE_NAME);
|
||||
cap->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
|
||||
|
@ -1519,7 +1519,7 @@ static int __enum_fmt(struct v4l2_fmtdesc *f, u32 type)
|
|||
if (!fmt)
|
||||
return -EINVAL;
|
||||
|
||||
strncpy(f->description, fmt->name, sizeof(f->description) - 1);
|
||||
strscpy(f->description, fmt->name, sizeof(f->description));
|
||||
f->pixelformat = fmt->fourcc;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -692,8 +692,8 @@ static const struct v4l2_fwht_pixfmt_info *find_fmt(u32 fmt)
|
|||
static int vidioc_querycap(struct file *file, void *priv,
|
||||
struct v4l2_capability *cap)
|
||||
{
|
||||
strncpy(cap->driver, VICODEC_NAME, sizeof(cap->driver) - 1);
|
||||
strncpy(cap->card, VICODEC_NAME, sizeof(cap->card) - 1);
|
||||
strscpy(cap->driver, VICODEC_NAME, sizeof(cap->driver));
|
||||
strscpy(cap->card, VICODEC_NAME, sizeof(cap->card));
|
||||
snprintf(cap->bus_info, sizeof(cap->bus_info),
|
||||
"platform:%s", VICODEC_NAME);
|
||||
return 0;
|
||||
|
|
|
@ -659,8 +659,8 @@ static void device_work(struct work_struct *w)
|
|||
static int vidioc_querycap(struct file *file, void *priv,
|
||||
struct v4l2_capability *cap)
|
||||
{
|
||||
strncpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver) - 1);
|
||||
strncpy(cap->card, MEM2MEM_NAME, sizeof(cap->card) - 1);
|
||||
strscpy(cap->driver, MEM2MEM_NAME, sizeof(cap->driver));
|
||||
strscpy(cap->card, MEM2MEM_NAME, sizeof(cap->card));
|
||||
snprintf(cap->bus_info, sizeof(cap->bus_info),
|
||||
"platform:%s", MEM2MEM_NAME);
|
||||
return 0;
|
||||
|
|
|
@ -681,7 +681,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst)
|
|||
dev->v4l2_dev.mdev = &dev->mdev;
|
||||
|
||||
/* Initialize media device */
|
||||
strlcpy(dev->mdev.model, VIVID_MODULE_NAME, sizeof(dev->mdev.model));
|
||||
strscpy(dev->mdev.model, VIVID_MODULE_NAME, sizeof(dev->mdev.model));
|
||||
snprintf(dev->mdev.bus_info, sizeof(dev->mdev.bus_info),
|
||||
"platform:%s-%03d", VIVID_MODULE_NAME, inst);
|
||||
dev->mdev.dev = &pdev->dev;
|
||||
|
|
|
@ -1272,7 +1272,7 @@ static int si4713_g_modulator(struct v4l2_subdev *sd, struct v4l2_modulator *vm)
|
|||
if (vm->index > 0)
|
||||
return -EINVAL;
|
||||
|
||||
strncpy(vm->name, "FM Modulator", 32);
|
||||
strscpy(vm->name, "FM Modulator", sizeof(vm->name));
|
||||
vm->capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LOW |
|
||||
V4L2_TUNER_CAP_RDS | V4L2_TUNER_CAP_RDS_CONTROLS;
|
||||
|
||||
|
|
|
@ -1132,7 +1132,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
|
|||
usb->usbdev = usbdev;
|
||||
usb_make_path(usbdev, go->bus_info, sizeof(go->bus_info));
|
||||
go->board_id = id->driver_info;
|
||||
strncpy(go->name, name, sizeof(go->name));
|
||||
strscpy(go->name, name, sizeof(go->name));
|
||||
if (board->flags & GO7007_USB_EZUSB)
|
||||
go->hpi_ops = &go7007_usb_ezusb_hpi_ops;
|
||||
else
|
||||
|
@ -1198,7 +1198,7 @@ static int go7007_usb_probe(struct usb_interface *intf,
|
|||
go->board_id = GO7007_BOARDID_ENDURA;
|
||||
usb->board = board = &board_endura;
|
||||
go->board_info = &board->main_info;
|
||||
strncpy(go->name, "Pelco Endura",
|
||||
strscpy(go->name, "Pelco Endura",
|
||||
sizeof(go->name));
|
||||
} else {
|
||||
u16 channel;
|
||||
|
@ -1232,21 +1232,21 @@ static int go7007_usb_probe(struct usb_interface *intf,
|
|||
case 1:
|
||||
go->tuner_type = TUNER_SONY_BTF_PG472Z;
|
||||
go->std = V4L2_STD_PAL;
|
||||
strncpy(go->name, "Plextor PX-TV402U-EU",
|
||||
sizeof(go->name));
|
||||
strscpy(go->name, "Plextor PX-TV402U-EU",
|
||||
sizeof(go->name));
|
||||
break;
|
||||
case 2:
|
||||
go->tuner_type = TUNER_SONY_BTF_PK467Z;
|
||||
go->std = V4L2_STD_NTSC_M_JP;
|
||||
num_i2c_devs -= 2;
|
||||
strncpy(go->name, "Plextor PX-TV402U-JP",
|
||||
sizeof(go->name));
|
||||
strscpy(go->name, "Plextor PX-TV402U-JP",
|
||||
sizeof(go->name));
|
||||
break;
|
||||
case 3:
|
||||
go->tuner_type = TUNER_SONY_BTF_PB463Z;
|
||||
num_i2c_devs -= 2;
|
||||
strncpy(go->name, "Plextor PX-TV402U-NA",
|
||||
sizeof(go->name));
|
||||
strscpy(go->name, "Plextor PX-TV402U-NA",
|
||||
sizeof(go->name));
|
||||
break;
|
||||
default:
|
||||
pr_debug("unable to detect tuner type!\n");
|
||||
|
|
|
@ -327,7 +327,7 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
|
|||
fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
fmt->flags = V4L2_FMT_FLAG_COMPRESSED;
|
||||
|
||||
strncpy(fmt->description, desc, sizeof(fmt->description));
|
||||
strscpy(fmt->description, desc, sizeof(fmt->description));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -769,8 +769,7 @@ static int vidioc_enum_input(struct file *file, void *_fh, struct v4l2_input *i)
|
|||
|
||||
i->type = V4L2_INPUT_TYPE_CAMERA;
|
||||
|
||||
strncpy(i->name, iname[n], sizeof(i->name) - 1);
|
||||
i->name[sizeof(i->name) - 1] = '\0';
|
||||
strscpy(i->name, iname[n], sizeof(i->name));
|
||||
|
||||
i->audioset = 1<<HDPVR_RCA_FRONT | 1<<HDPVR_RCA_BACK | 1<<HDPVR_SPDIF;
|
||||
|
||||
|
@ -841,8 +840,7 @@ static int vidioc_enumaudio(struct file *file, void *priv,
|
|||
|
||||
audio->capability = V4L2_AUDCAP_STEREO;
|
||||
|
||||
strncpy(audio->name, audio_iname[n], sizeof(audio->name) - 1);
|
||||
audio->name[sizeof(audio->name) - 1] = '\0';
|
||||
strscpy(audio->name, audio_iname[n], sizeof(audio->name));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -874,7 +872,6 @@ static int vidioc_g_audio(struct file *file, void *private_data,
|
|||
audio->index = dev->options.audio_input;
|
||||
audio->capability = V4L2_AUDCAP_STEREO;
|
||||
strscpy(audio->name, audio_iname[audio->index], sizeof(audio->name));
|
||||
audio->name[sizeof(audio->name) - 1] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -991,7 +988,8 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *private_data,
|
|||
return -EINVAL;
|
||||
|
||||
f->flags = V4L2_FMT_FLAG_COMPRESSED;
|
||||
strncpy(f->description, "MPEG2-TS with AVC/AAC streams", 32);
|
||||
strscpy(f->description, "MPEG2-TS with AVC/AAC streams",
|
||||
sizeof(f->description));
|
||||
f->pixelformat = V4L2_PIX_FMT_MPEG;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -435,7 +435,7 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio,
|
|||
err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 0);
|
||||
if (err)
|
||||
return err;
|
||||
strncpy(log_addrs->osd_name, data, 13);
|
||||
strscpy(log_addrs->osd_name, data, sizeof(log_addrs->osd_name));
|
||||
dev_dbg(pulse8->dev, "OSD name: %s\n", log_addrs->osd_name);
|
||||
|
||||
return 0;
|
||||
|
@ -566,7 +566,7 @@ static int pulse8_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr)
|
|||
char *osd_str = cmd + 1;
|
||||
|
||||
cmd[0] = MSGCODE_SET_OSD_NAME;
|
||||
strncpy(cmd + 1, adap->log_addrs.osd_name, 13);
|
||||
strscpy(cmd + 1, adap->log_addrs.osd_name, sizeof(cmd) - 1);
|
||||
if (osd_len < 4) {
|
||||
memset(osd_str + osd_len, ' ', 4 - osd_len);
|
||||
osd_len = 4;
|
||||
|
|
|
@ -2459,9 +2459,8 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
|
|||
if (!(qctrl.flags & V4L2_CTRL_FLAG_READ_ONLY)) {
|
||||
ciptr->set_value = ctrl_cx2341x_set;
|
||||
}
|
||||
strncpy(hdw->mpeg_ctrl_info[idx].desc,qctrl.name,
|
||||
PVR2_CTLD_INFO_DESC_SIZE);
|
||||
hdw->mpeg_ctrl_info[idx].desc[PVR2_CTLD_INFO_DESC_SIZE-1] = 0;
|
||||
strscpy(hdw->mpeg_ctrl_info[idx].desc, qctrl.name,
|
||||
sizeof(hdw->mpeg_ctrl_info[idx].desc));
|
||||
ciptr->default_value = qctrl.default_value;
|
||||
switch (qctrl.type) {
|
||||
default:
|
||||
|
|
|
@ -284,7 +284,7 @@ static int pvr2_enumaudio(struct file *file, void *priv, struct v4l2_audio *vin)
|
|||
|
||||
if (vin->index > 0)
|
||||
return -EINVAL;
|
||||
strncpy(vin->name, "PVRUSB2 Audio", 14);
|
||||
strscpy(vin->name, "PVRUSB2 Audio", sizeof(vin->name));
|
||||
vin->capability = V4L2_AUDCAP_STEREO;
|
||||
return 0;
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ static int pvr2_g_audio(struct file *file, void *priv, struct v4l2_audio *vin)
|
|||
{
|
||||
/* pkt: FIXME: see above comment (VIDIOC_ENUMAUDIO) */
|
||||
vin->index = 0;
|
||||
strncpy(vin->name, "PVRUSB2 Audio", 14);
|
||||
strscpy(vin->name, "PVRUSB2 Audio", sizeof(vin->name));
|
||||
vin->capability = V4L2_AUDCAP_STEREO;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2404,7 +2404,7 @@ static int bcm2048_vidioc_g_audio(struct file *file, void *priv,
|
|||
if (audio->index > 1)
|
||||
return -EINVAL;
|
||||
|
||||
strncpy(audio->name, "Radio", 32);
|
||||
strscpy(audio->name, "Radio", sizeof(audio->name));
|
||||
audio->capability = V4L2_AUDCAP_STEREO;
|
||||
|
||||
return 0;
|
||||
|
@ -2432,7 +2432,7 @@ static int bcm2048_vidioc_g_tuner(struct file *file, void *priv,
|
|||
if (tuner->index > 0)
|
||||
return -EINVAL;
|
||||
|
||||
strncpy(tuner->name, "FM Receiver", 32);
|
||||
strscpy(tuner->name, "FM Receiver", sizeof(tuner->name));
|
||||
tuner->type = V4L2_TUNER_RADIO;
|
||||
tuner->rangelow =
|
||||
dev_to_v4l2(bcm2048_get_region_bottom_frequency(bdev));
|
||||
|
|
|
@ -63,7 +63,7 @@ static int imx_ic_probe(struct platform_device *pdev)
|
|||
priv->sd.owner = THIS_MODULE;
|
||||
priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
|
||||
priv->sd.grp_id = pdata->grp_id;
|
||||
strncpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name));
|
||||
strscpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name));
|
||||
|
||||
ret = ic_ops[priv->task_id]->init(priv);
|
||||
if (ret)
|
||||
|
|
|
@ -964,7 +964,7 @@ static int imx_vdic_probe(struct platform_device *pdev)
|
|||
priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
|
||||
/* get our group id */
|
||||
priv->sd.grp_id = pdata->grp_id;
|
||||
strncpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name));
|
||||
strscpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name));
|
||||
|
||||
mutex_init(&priv->lock);
|
||||
|
||||
|
|
|
@ -1526,8 +1526,8 @@ static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag)
|
|||
|
||||
for (num = i = 0; i < NUM_FORMATS; i++) {
|
||||
if (zoran_formats[i].flags & flag && num++ == fmt->index) {
|
||||
strncpy(fmt->description, zoran_formats[i].name,
|
||||
sizeof(fmt->description) - 1);
|
||||
strscpy(fmt->description, zoran_formats[i].name,
|
||||
sizeof(fmt->description));
|
||||
/* fmt struct pre-zeroed, so adding '\0' not needed */
|
||||
fmt->pixelformat = zoran_formats[i].fourcc;
|
||||
if (zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED)
|
||||
|
@ -2301,8 +2301,8 @@ static int zoran_enum_input(struct file *file, void *__fh,
|
|||
if (inp->index >= zr->card.inputs)
|
||||
return -EINVAL;
|
||||
|
||||
strncpy(inp->name, zr->card.input[inp->index].name,
|
||||
sizeof(inp->name) - 1);
|
||||
strscpy(inp->name, zr->card.input[inp->index].name,
|
||||
sizeof(inp->name));
|
||||
inp->type = V4L2_INPUT_TYPE_CAMERA;
|
||||
inp->std = V4L2_STD_ALL;
|
||||
|
||||
|
@ -2344,7 +2344,7 @@ static int zoran_enum_output(struct file *file, void *__fh,
|
|||
|
||||
outp->index = 0;
|
||||
outp->type = V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY;
|
||||
strncpy(outp->name, "Autodetect", sizeof(outp->name)-1);
|
||||
strscpy(outp->name, "Autodetect", sizeof(outp->name));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue