aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-10-29 10:26:12 -0400
committerTakashi Iwai <tiwai@suse.de>2013-10-29 10:26:12 -0400
commit57a4451d26eef4ccbf3b32fd116295f001c18cb4 (patch)
treed428b8eb301cc0a5125eb0af65eeb21b82255343 /sound/pci
parent97f44f56ca94709f45bc348f5d2c88696eae5f9b (diff)
ALSA: Use strlcpy() instead of strncpy()
We tend to make stupid mistakes with strncpy(). Let's take a safer one, strlcpy(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/cs5535audio/cs5535audio_olpc.c4
-rw-r--r--sound/pci/ice1712/psc724.c4
-rw-r--r--sound/pci/ice1712/wm8776.c2
-rw-r--r--sound/pci/rme9652/hdspm.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/sound/pci/cs5535audio/cs5535audio_olpc.c b/sound/pci/cs5535audio/cs5535audio_olpc.c
index da1cb9c4c76c..e6a44507d557 100644
--- a/sound/pci/cs5535audio/cs5535audio_olpc.c
+++ b/sound/pci/cs5535audio/cs5535audio_olpc.c
@@ -161,13 +161,13 @@ int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
161 /* drop the original AD1888 HPF control */ 161 /* drop the original AD1888 HPF control */
162 memset(&elem, 0, sizeof(elem)); 162 memset(&elem, 0, sizeof(elem));
163 elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 163 elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
164 strncpy(elem.name, "High Pass Filter Enable", sizeof(elem.name)); 164 strlcpy(elem.name, "High Pass Filter Enable", sizeof(elem.name));
165 snd_ctl_remove_id(card, &elem); 165 snd_ctl_remove_id(card, &elem);
166 166
167 /* drop the original V_REFOUT control */ 167 /* drop the original V_REFOUT control */
168 memset(&elem, 0, sizeof(elem)); 168 memset(&elem, 0, sizeof(elem));
169 elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 169 elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
170 strncpy(elem.name, "V_REFOUT Enable", sizeof(elem.name)); 170 strlcpy(elem.name, "V_REFOUT Enable", sizeof(elem.name));
171 snd_ctl_remove_id(card, &elem); 171 snd_ctl_remove_id(card, &elem);
172 172
173 /* add the OLPC-specific controls */ 173 /* add the OLPC-specific controls */
diff --git a/sound/pci/ice1712/psc724.c b/sound/pci/ice1712/psc724.c
index 302ac6ddd545..4019cf27d117 100644
--- a/sound/pci/ice1712/psc724.c
+++ b/sound/pci/ice1712/psc724.c
@@ -203,12 +203,12 @@ static void psc724_set_jack_state(struct snd_ice1712 *ice, bool hp_connected)
203 /* notify about master speaker mute change */ 203 /* notify about master speaker mute change */
204 memset(&elem_id, 0, sizeof(elem_id)); 204 memset(&elem_id, 0, sizeof(elem_id));
205 elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 205 elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
206 strncpy(elem_id.name, "Master Speakers Playback Switch", 206 strlcpy(elem_id.name, "Master Speakers Playback Switch",
207 sizeof(elem_id.name)); 207 sizeof(elem_id.name));
208 kctl = snd_ctl_find_id(ice->card, &elem_id); 208 kctl = snd_ctl_find_id(ice->card, &elem_id);
209 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); 209 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
210 /* and headphone mute change */ 210 /* and headphone mute change */
211 strncpy(elem_id.name, spec->wm8776.ctl[WM8776_CTL_HP_SW].name, 211 strlcpy(elem_id.name, spec->wm8776.ctl[WM8776_CTL_HP_SW].name,
212 sizeof(elem_id.name)); 212 sizeof(elem_id.name));
213 kctl = snd_ctl_find_id(ice->card, &elem_id); 213 kctl = snd_ctl_find_id(ice->card, &elem_id);
214 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); 214 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
diff --git a/sound/pci/ice1712/wm8776.c b/sound/pci/ice1712/wm8776.c
index a3c05fe5daf9..5227cb08247f 100644
--- a/sound/pci/ice1712/wm8776.c
+++ b/sound/pci/ice1712/wm8776.c
@@ -52,7 +52,7 @@ static void snd_wm8776_activate_ctl(struct snd_wm8776 *wm,
52 unsigned int index_offset; 52 unsigned int index_offset;
53 53
54 memset(&elem_id, 0, sizeof(elem_id)); 54 memset(&elem_id, 0, sizeof(elem_id));
55 strncpy(elem_id.name, ctl_name, sizeof(elem_id.name)); 55 strlcpy(elem_id.name, ctl_name, sizeof(elem_id.name));
56 elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 56 elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
57 kctl = snd_ctl_find_id(card, &elem_id); 57 kctl = snd_ctl_find_id(card, &elem_id);
58 if (!kctl) 58 if (!kctl)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 2907e68150cb..e98dc008de0b 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -6400,7 +6400,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
6400 memset(&hdspm_version, 0, sizeof(hdspm_version)); 6400 memset(&hdspm_version, 0, sizeof(hdspm_version));
6401 6401
6402 hdspm_version.card_type = hdspm->io_type; 6402 hdspm_version.card_type = hdspm->io_type;
6403 strncpy(hdspm_version.cardname, hdspm->card_name, 6403 strlcpy(hdspm_version.cardname, hdspm->card_name,
6404 sizeof(hdspm_version.cardname)); 6404 sizeof(hdspm_version.cardname));
6405 hdspm_version.serial = hdspm->serial; 6405 hdspm_version.serial = hdspm->serial;
6406 hdspm_version.firmware_rev = hdspm->firmware_rev; 6406 hdspm_version.firmware_rev = hdspm->firmware_rev;