summaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1/p16v.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-11-15 13:16:02 +0100
committerMercurial server <hg@alsa0.alsa-project.org>2007-11-20 20:03:39 +0100
commitaa299d01f1c2e680e40813b63f8dfb46c79ea715 (patch)
tree7d8aa11cf32d807faa8d971029d7d174dab63c06 /sound/pci/emu10k1/p16v.c
parent74415a36767d99d3adf31b4a62e4e50725e6b66a (diff)
downloadop-kernel-dev-aa299d01f1c2e680e40813b63f8dfb46c79ea715.zip
op-kernel-dev-aa299d01f1c2e680e40813b63f8dfb46c79ea715.tar.gz
[ALSA] emu10k1 - Check value ranges in ctl callbacks
Check value ranges in ctl callbacks properly. This fixes the unexpected crash due to wrong value assignment. Also, remove invalid comments in the last patch. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/emu10k1/p16v.c')
-rw-r--r--sound/pci/emu10k1/p16v.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index d619a38..9fd3135 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -742,6 +742,8 @@ static int snd_p16v_capture_source_put(struct snd_kcontrol *kcontrol,
u32 source;
val = ucontrol->value.enumerated.item[0] ;
+ if (val > 7)
+ return -EINVAL;
change = (emu->p16v_capture_source != val);
if (change) {
emu->p16v_capture_source = val;
@@ -784,6 +786,8 @@ static int snd_p16v_capture_channel_put(struct snd_kcontrol *kcontrol,
u32 tmp;
val = ucontrol->value.enumerated.item[0] ;
+ if (val > 3)
+ return -EINVAL;
change = (emu->p16v_capture_channel != val);
if (change) {
emu->p16v_capture_channel = val;
OpenPOWER on IntegriCloud