aboutsummaryrefslogtreecommitdiffstats
path: root/sound/ppc/beep.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-11-15 10:14:12 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:25 -0500
commitd4079ac49a08e36d6839a9ceb26aec8c24c9ed82 (patch)
tree91ebc493375fd4e7fa84c3a6ab67a885121b1c81 /sound/ppc/beep.c
parentd05ab185b770de96399766be6bcb5769ab99bc09 (diff)
[ALSA] powermac - Check value range in ctl callbacks
Check the value ranges in ctl put callbacks properly in snd-powermac driver. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/ppc/beep.c')
-rw-r--r--sound/ppc/beep.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c
index 566b5ab9d4e8..465dd0466b9f 100644
--- a/sound/ppc/beep.c
+++ b/sound/ppc/beep.c
@@ -195,10 +195,13 @@ static int snd_pmac_put_beep(struct snd_kcontrol *kcontrol,
195 struct snd_ctl_elem_value *ucontrol) 195 struct snd_ctl_elem_value *ucontrol)
196{ 196{
197 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); 197 struct snd_pmac *chip = snd_kcontrol_chip(kcontrol);
198 int oval; 198 unsigned int oval, nval;
199 snd_assert(chip->beep, return -ENXIO); 199 snd_assert(chip->beep, return -ENXIO);
200 oval = chip->beep->volume; 200 oval = chip->beep->volume;
201 chip->beep->volume = ucontrol->value.integer.value[0]; 201 nval = ucontrol->value.integer.value[0];
202 if (nval > 100)
203 return -EINVAL;
204 chip->beep->volume = nval;
202 return oval != chip->beep->volume; 205 return oval != chip->beep->volume;
203} 206}
204 207