diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-11-15 10:17:24 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 11:29:25 -0500 |
commit | 3b892467786410f26dffc2c7bccd3ea445604037 (patch) | |
tree | 4a70f86b1545e9be95d987fc248cac3cebbbd9a8 /sound/sh/aica.c | |
parent | 498ade1a133dffd0f3ee90952737045d56e6689a (diff) |
[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/aica.c')
-rw-r--r-- | sound/sh/aica.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/sh/aica.c b/sound/sh/aica.c index 8861d2f7796..12c41df255a 100644 --- a/sound/sh/aica.c +++ b/sound/sh/aica.c | |||
@@ -523,11 +523,14 @@ static int aica_pcmvolume_put(struct snd_kcontrol *kcontrol, | |||
523 | struct snd_ctl_elem_value *ucontrol) | 523 | struct snd_ctl_elem_value *ucontrol) |
524 | { | 524 | { |
525 | struct snd_card_aica *dreamcastcard; | 525 | struct snd_card_aica *dreamcastcard; |
526 | unsigned int vol; | ||
526 | dreamcastcard = kcontrol->private_data; | 527 | dreamcastcard = kcontrol->private_data; |
527 | if (unlikely(!dreamcastcard->channel)) | 528 | if (unlikely(!dreamcastcard->channel)) |
528 | return -ETXTBSY; | 529 | return -ETXTBSY; |
529 | if (unlikely(dreamcastcard->channel->vol == | 530 | vol = ucontrol->value.integer.value[0]; |
530 | ucontrol->value.integer.value[0])) | 531 | if (vol > 0xff) |
532 | return -EINVAL; | ||
533 | if (unlikely(dreamcastcard->channel->vol == vol)) | ||
531 | return 0; | 534 | return 0; |
532 | dreamcastcard->channel->vol = ucontrol->value.integer.value[0]; | 535 | dreamcastcard->channel->vol = ucontrol->value.integer.value[0]; |
533 | dreamcastcard->master_volume = ucontrol->value.integer.value[0]; | 536 | dreamcastcard->master_volume = ucontrol->value.integer.value[0]; |