[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>
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index 8861d2f..12c41df 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -523,11 +523,14 @@
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];