diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-11-15 15:54:38 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 17:29:24 +0100 |
commit | 68ea7b2f2d8c1effd662fded04e9a589cb640da6 (patch) | |
tree | e104282748345692c2a71572a260bf926501ebde /sound/pci/hda/hda_codec.c | |
parent | 7e39e2273a9b8182ed1b21af5444e29843fc06ca (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.c | 3 |
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 */ |