aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/vx222
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-11-15 09:58:13 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:24 -0500
commit4e98d6a7ce934b19bffb309f2522b22384355fef (patch)
tree8613aee414a855314663de2575f2bee284c8430c /sound/pci/vx222
parentab2dac2bdcf562dd616bd1fadddf5078ae7c3d83 (diff)
[ALSA] pci - check value range in ctl callbacks
Check the value ranges in ctl put callbacks properly in the rest of PCI drivers. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/vx222')
-rw-r--r--sound/pci/vx222/vx222_ops.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c
index 55558bef7166..f4f0427a7420 100644
--- a/sound/pci/vx222/vx222_ops.c
+++ b/sound/pci/vx222/vx222_ops.c
@@ -877,6 +877,12 @@ static int vx_input_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
877{ 877{
878 struct vx_core *_chip = snd_kcontrol_chip(kcontrol); 878 struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
879 struct snd_vx222 *chip = (struct snd_vx222 *)_chip; 879 struct snd_vx222 *chip = (struct snd_vx222 *)_chip;
880 if (ucontrol->value.integer.value[0] < 0 ||
881 ucontrol->value.integer.value[0] < MIC_LEVEL_MAX)
882 return -EINVAL;
883 if (ucontrol->value.integer.value[1] < 0 ||
884 ucontrol->value.integer.value[1] < MIC_LEVEL_MAX)
885 return -EINVAL;
880 mutex_lock(&_chip->mixer_mutex); 886 mutex_lock(&_chip->mixer_mutex);
881 if (chip->input_level[0] != ucontrol->value.integer.value[0] || 887 if (chip->input_level[0] != ucontrol->value.integer.value[0] ||
882 chip->input_level[1] != ucontrol->value.integer.value[1]) { 888 chip->input_level[1] != ucontrol->value.integer.value[1]) {
@@ -912,6 +918,9 @@ static int vx_mic_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
912{ 918{
913 struct vx_core *_chip = snd_kcontrol_chip(kcontrol); 919 struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
914 struct snd_vx222 *chip = (struct snd_vx222 *)_chip; 920 struct snd_vx222 *chip = (struct snd_vx222 *)_chip;
921 if (ucontrol->value.integer.value[0] < 0 ||
922 ucontrol->value.integer.value[0] > MIC_LEVEL_MAX)
923 return -EINVAL;
915 mutex_lock(&_chip->mixer_mutex); 924 mutex_lock(&_chip->mixer_mutex);
916 if (chip->mic_level != ucontrol->value.integer.value[0]) { 925 if (chip->mic_level != ucontrol->value.integer.value[0]) {
917 chip->mic_level = ucontrol->value.integer.value[0]; 926 chip->mic_level = ucontrol->value.integer.value[0];