Commit cebfadff authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (7756): ivtv: use strlcpy instead of strcpy

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent ecfcc83b
...@@ -1122,7 +1122,8 @@ int ivtv_get_input(struct ivtv *itv, u16 index, struct v4l2_input *input) ...@@ -1122,7 +1122,8 @@ int ivtv_get_input(struct ivtv *itv, u16 index, struct v4l2_input *input)
if (index >= itv->nof_inputs) if (index >= itv->nof_inputs)
return -EINVAL; return -EINVAL;
input->index = index; input->index = index;
strcpy(input->name, input_strs[card_input->video_type - 1]); strlcpy(input->name, input_strs[card_input->video_type - 1],
sizeof(input->name));
input->type = (card_input->video_type == IVTV_CARD_INPUT_VID_TUNER ? input->type = (card_input->video_type == IVTV_CARD_INPUT_VID_TUNER ?
V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA); V4L2_INPUT_TYPE_TUNER : V4L2_INPUT_TYPE_CAMERA);
input->audioset = (1 << itv->nof_audio_inputs) - 1; input->audioset = (1 << itv->nof_audio_inputs) - 1;
...@@ -1139,7 +1140,7 @@ int ivtv_get_output(struct ivtv *itv, u16 index, struct v4l2_output *output) ...@@ -1139,7 +1140,7 @@ int ivtv_get_output(struct ivtv *itv, u16 index, struct v4l2_output *output)
if (index >= itv->card->nof_outputs) if (index >= itv->card->nof_outputs)
return -EINVAL; return -EINVAL;
output->index = index; output->index = index;
strcpy(output->name, card_output->name); strlcpy(output->name, card_output->name, sizeof(output->name));
output->type = V4L2_OUTPUT_TYPE_ANALOG; output->type = V4L2_OUTPUT_TYPE_ANALOG;
output->audioset = 1; output->audioset = 1;
output->std = V4L2_STD_ALL; output->std = V4L2_STD_ALL;
...@@ -1158,7 +1159,8 @@ int ivtv_get_audio_input(struct ivtv *itv, u16 index, struct v4l2_audio *audio) ...@@ -1158,7 +1159,8 @@ int ivtv_get_audio_input(struct ivtv *itv, u16 index, struct v4l2_audio *audio)
memset(audio, 0, sizeof(*audio)); memset(audio, 0, sizeof(*audio));
if (index >= itv->nof_audio_inputs) if (index >= itv->nof_audio_inputs)
return -EINVAL; return -EINVAL;
strcpy(audio->name, input_strs[aud_input->audio_type - 1]); strlcpy(audio->name, input_strs[aud_input->audio_type - 1],
sizeof(audio->name));
audio->index = index; audio->index = index;
audio->capability = V4L2_AUDCAP_STEREO; audio->capability = V4L2_AUDCAP_STEREO;
return 0; return 0;
...@@ -1169,6 +1171,6 @@ int ivtv_get_audio_output(struct ivtv *itv, u16 index, struct v4l2_audioout *aud ...@@ -1169,6 +1171,6 @@ int ivtv_get_audio_output(struct ivtv *itv, u16 index, struct v4l2_audioout *aud
memset(aud_output, 0, sizeof(*aud_output)); memset(aud_output, 0, sizeof(*aud_output));
if (itv->card->video_outputs == NULL || index != 0) if (itv->card->video_outputs == NULL || index != 0)
return -EINVAL; return -EINVAL;
strcpy(aud_output->name, "A/V Audio Out"); strlcpy(aud_output->name, "A/V Audio Out", sizeof(aud_output->name));
return 0; return 0;
} }
...@@ -167,7 +167,8 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) ...@@ -167,7 +167,8 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
return -1; return -1;
id = hw_driverids[idx]; id = hw_driverids[idx];
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
strcpy(info.driver_name, hw_drivernames[idx]); strlcpy(info.driver_name, hw_drivernames[idx],
sizeof(info.driver_name));
info.addr = hw_addrs[idx]; info.addr = hw_addrs[idx];
for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {} for (i = 0; itv->i2c_clients[i] && i < I2C_CLIENTS_MAX; i++) {}
......
...@@ -741,10 +741,9 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void ...@@ -741,10 +741,9 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
struct v4l2_capability *vcap = arg; struct v4l2_capability *vcap = arg;
memset(vcap, 0, sizeof(*vcap)); memset(vcap, 0, sizeof(*vcap));
strcpy(vcap->driver, IVTV_DRIVER_NAME); /* driver name */ strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver));
strncpy(vcap->card, itv->card_name, strlcpy(vcap->card, itv->card_name, sizeof(vcap->card));
sizeof(vcap->card)-1); /* card type */ strlcpy(vcap->bus_info, pci_name(itv->dev), sizeof(vcap->bus_info));
strcpy(vcap->bus_info, pci_name(itv->dev)); /* bus info... */
vcap->version = IVTV_DRIVER_VERSION; /* version */ vcap->version = IVTV_DRIVER_VERSION; /* version */
vcap->capabilities = itv->v4l2_cap; /* capabilities */ vcap->capabilities = itv->v4l2_cap; /* capabilities */
...@@ -1018,7 +1017,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void ...@@ -1018,7 +1017,7 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
ivtv_std_60hz : ivtv_std_50hz; ivtv_std_60hz : ivtv_std_50hz;
vs->index = idx; vs->index = idx;
vs->id = enum_stds[idx].std; vs->id = enum_stds[idx].std;
strcpy(vs->name, enum_stds[idx].name); strlcpy(vs->name, enum_stds[idx].name, sizeof(vs->name));
break; break;
} }
...@@ -1102,10 +1101,10 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void ...@@ -1102,10 +1101,10 @@ int ivtv_v4l2_ioctls(struct ivtv *itv, struct file *filp, unsigned int cmd, void
ivtv_call_i2c_clients(itv, VIDIOC_G_TUNER, vt); ivtv_call_i2c_clients(itv, VIDIOC_G_TUNER, vt);
if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) { if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) {
strcpy(vt->name, "ivtv Radio Tuner"); strlcpy(vt->name, "ivtv Radio Tuner", sizeof(vt->name));
vt->type = V4L2_TUNER_RADIO; vt->type = V4L2_TUNER_RADIO;
} else { } else {
strcpy(vt->name, "ivtv TV Tuner"); strlcpy(vt->name, "ivtv TV Tuner", sizeof(vt->name));
vt->type = V4L2_TUNER_ANALOG_TV; vt->type = V4L2_TUNER_ANALOG_TV;
} }
break; break;
......
...@@ -532,7 +532,7 @@ static int ivtvfb_get_fix(struct ivtv *itv, struct fb_fix_screeninfo *fix) ...@@ -532,7 +532,7 @@ static int ivtvfb_get_fix(struct ivtv *itv, struct fb_fix_screeninfo *fix)
IVTVFB_DEBUG_INFO("ivtvfb_get_fix\n"); IVTVFB_DEBUG_INFO("ivtvfb_get_fix\n");
memset(fix, 0, sizeof(struct fb_fix_screeninfo)); memset(fix, 0, sizeof(struct fb_fix_screeninfo));
strcpy(fix->id, "cx23415 TV out"); strlcpy(fix->id, "cx23415 TV out", sizeof(fix->id));
fix->smem_start = oi->video_pbase; fix->smem_start = oi->video_pbase;
fix->smem_len = oi->video_buffer_size; fix->smem_len = oi->video_buffer_size;
fix->type = FB_TYPE_PACKED_PIXELS; fix->type = FB_TYPE_PACKED_PIXELS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment