diff options
author | Takashi Iwai <tiwai@suse.de> | 2013-10-29 10:26:12 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-10-29 10:26:12 -0400 |
commit | 57a4451d26eef4ccbf3b32fd116295f001c18cb4 (patch) | |
tree | d428b8eb301cc0a5125eb0af65eeb21b82255343 /sound | |
parent | 97f44f56ca94709f45bc348f5d2c88696eae5f9b (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')
-rw-r--r-- | sound/arm/pxa2xx-ac97.c | 2 | ||||
-rw-r--r-- | sound/i2c/other/ak4xxx-adda.c | 2 | ||||
-rw-r--r-- | sound/pci/cs5535audio/cs5535audio_olpc.c | 4 | ||||
-rw-r--r-- | sound/pci/ice1712/psc724.c | 4 | ||||
-rw-r--r-- | sound/pci/ice1712/wm8776.c | 2 | ||||
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 2 |
6 files changed, 8 insertions, 8 deletions
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 5066a3768b28..9a2ac1e0f77a 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c | |||
@@ -185,7 +185,7 @@ static int pxa2xx_ac97_probe(struct platform_device *dev) | |||
185 | goto err; | 185 | goto err; |
186 | 186 | ||
187 | card->dev = &dev->dev; | 187 | card->dev = &dev->dev; |
188 | strncpy(card->driver, dev->dev.driver->name, sizeof(card->driver)); | 188 | strlcpy(card->driver, dev->dev.driver->name, sizeof(card->driver)); |
189 | 189 | ||
190 | ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm); | 190 | ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm); |
191 | if (ret) | 191 | if (ret) |
diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c index ed726d1569e8..f3735e64791c 100644 --- a/sound/i2c/other/ak4xxx-adda.c +++ b/sound/i2c/other/ak4xxx-adda.c | |||
@@ -583,7 +583,7 @@ static int ak4xxx_capture_source_info(struct snd_kcontrol *kcontrol, | |||
583 | if (idx >= num_names) | 583 | if (idx >= num_names) |
584 | return -EINVAL; | 584 | return -EINVAL; |
585 | input_names = ak->adc_info[mixer_ch].input_names; | 585 | input_names = ak->adc_info[mixer_ch].input_names; |
586 | strncpy(uinfo->value.enumerated.name, input_names[idx], | 586 | strlcpy(uinfo->value.enumerated.name, input_names[idx], |
587 | sizeof(uinfo->value.enumerated.name)); | 587 | sizeof(uinfo->value.enumerated.name)); |
588 | return 0; | 588 | return 0; |
589 | } | 589 | } |
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; |