From d4079ac49a08e36d6839a9ceb26aec8c24c9ed82 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 15 Nov 2007 16:14:12 +0100 Subject: [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 Signed-off-by: Jaroslav Kysela --- sound/ppc/beep.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sound/ppc/beep.c') 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, struct snd_ctl_elem_value *ucontrol) { struct snd_pmac *chip = snd_kcontrol_chip(kcontrol); - int oval; + unsigned int oval, nval; snd_assert(chip->beep, return -ENXIO); oval = chip->beep->volume; - chip->beep->volume = ucontrol->value.integer.value[0]; + nval = ucontrol->value.integer.value[0]; + if (nval > 100) + return -EINVAL; + chip->beep->volume = nval; return oval != chip->beep->volume; } -- cgit