summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-11-15 15:54:38 +0100
committerJaroslav Kysela <perex@perex.cz>2008-01-31 17:29:24 +0100
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 39240e0ea56..23d3befef57 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,
unsigned int mode;
mode = ucontrol->value.enumerated.item[0];
- snd_assert(mode < num_chmodes, return -EINVAL);
+ if (mode >= num_chmodes)
+ return -EINVAL;
if (*max_channelsp == chmode[mode].channels)
return 0;
/* change the current channel setting */