aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-11-15 09:54:38 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:24 -0500
commit68ea7b2f2d8c1effd662fded04e9a589cb640da6 (patch)
treee104282748345692c2a71572a260bf926501ebde /sound/pci/hda/hda_codec.c
parent7e39e2273a9b8182ed1b21af5444e29843fc06ca (diff)
[ALSA] hda-codec - Check value range in ctl callbacks
Check the value ranges in ctl put callbacks properly so that invalid values won't be stored or written to registers. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 39240e0ea568..23d3befef57b 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2337,7 +2337,8 @@ int snd_hda_ch_mode_put(struct hda_codec *codec,
2337 unsigned int mode; 2337 unsigned int mode;
2338 2338
2339 mode = ucontrol->value.enumerated.item[0]; 2339 mode = ucontrol->value.enumerated.item[0];
2340 snd_assert(mode < num_chmodes, return -EINVAL); 2340 if (mode >= num_chmodes)
2341 return -EINVAL;
2341 if (*max_channelsp == chmode[mode].channels) 2342 if (*max_channelsp == chmode[mode].channels)
2342 return 0; 2343 return 0;
2343 /* change the current channel setting */ 2344 /* change the current channel setting */