aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pcmcia
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-11-15 16:13:32 +0100
committerJaroslav Kysela <perex@perex.cz>2008-01-31 17:29:25 +0100
commitd05ab185b770de96399766be6bcb5769ab99bc09 (patch)
tree4dbcebd67139f890aa5568ba06efbecf4fd40454 /sound/pcmcia
parent9c45ba100501c206658f356ea1db3263947b9a30 (diff)
downloadkernel_samsung_smdk4412-d05ab185b770de96399766be6bcb5769ab99bc09.zip
kernel_samsung_smdk4412-d05ab185b770de96399766be6bcb5769ab99bc09.tar.gz
kernel_samsung_smdk4412-d05ab185b770de96399766be6bcb5769ab99bc09.tar.bz2
[ALSA] vxpocket - Check value range in ctl callbacks
Check the value ranges in ctl put callbacks in vxpocket driver. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pcmcia')
-rw-r--r--sound/pcmcia/vx/vxp_mixer.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/pcmcia/vx/vxp_mixer.c b/sound/pcmcia/vx/vxp_mixer.c
index 1eff158..bf9d3b3 100644
--- a/sound/pcmcia/vx/vxp_mixer.c
+++ b/sound/pcmcia/vx/vxp_mixer.c
@@ -53,6 +53,10 @@ static int vx_mic_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
{
struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+ unsigned int val = ucontrol->value.integer.value[0];
+
+ if (val > MIC_LEVEL_MAX)
+ return -EINVAL;
mutex_lock(&_chip->mixer_mutex);
if (chip->mic_level != ucontrol->value.integer.value[0]) {
vx_set_mic_level(_chip, ucontrol->value.integer.value[0]);
@@ -94,10 +98,11 @@ static int vx_mic_boost_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
{
struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
+ int val = !!ucontrol->value.integer.value[0];
mutex_lock(&_chip->mixer_mutex);
- if (chip->mic_level != ucontrol->value.integer.value[0]) {
- vx_set_mic_boost(_chip, ucontrol->value.integer.value[0]);
- chip->mic_level = ucontrol->value.integer.value[0];
+ if (chip->mic_level != val) {
+ vx_set_mic_boost(_chip, val);
+ chip->mic_level = val;
mutex_unlock(&_chip->mixer_mutex);
return 1;
}