summaryrefslogtreecommitdiffstats
path: root/sound/sh
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-11-15 16:17:24 +0100
committerJaroslav Kysela <perex@perex.cz>2008-01-31 17:29:25 +0100
commit3b892467786410f26dffc2c7bccd3ea445604037 (patch)
tree4a70f86b1545e9be95d987fc248cac3cebbbd9a8 /sound/sh
parent498ade1a133dffd0f3ee90952737045d56e6689a (diff)
downloadlinux-3b892467786410f26dffc2c7bccd3ea445604037.tar.bz2
[ALSA] Check value range in ctl callbacks
Check the value ranges in ctl put callbacks properly (in the rest drivers). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/sh')
-rw-r--r--sound/sh/aica.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index 8861d2f7796e..12c41df255a1 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -523,11 +523,14 @@ static int aica_pcmvolume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_card_aica *dreamcastcard;
+ unsigned int vol;
dreamcastcard = kcontrol->private_data;
if (unlikely(!dreamcastcard->channel))
return -ETXTBSY;
- if (unlikely(dreamcastcard->channel->vol ==
- ucontrol->value.integer.value[0]))
+ vol = ucontrol->value.integer.value[0];
+ if (vol > 0xff)
+ return -EINVAL;
+ if (unlikely(dreamcastcard->channel->vol == vol))
return 0;
dreamcastcard->channel->vol = ucontrol->value.integer.value[0];
dreamcastcard->master_volume = ucontrol->value.integer.value[0];