mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
[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 <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]>
This commit is contained in:
parent
498ade1a13
commit
3b89246778
6 changed files with 36 additions and 8 deletions
|
|
@ -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];
|
||||
|
|
|
|||
Loading…
Reference in a new issue