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/pci/ice1712 | |
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/pci/ice1712')
-rw-r--r-- | sound/pci/ice1712/psc724.c | 4 | ||||
-rw-r--r-- | sound/pci/ice1712/wm8776.c | 2 |
2 files changed, 3 insertions, 3 deletions
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) |