[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>
This commit is contained in:
Takashi Iwai
2007-11-15 16:17:24 +01:00
کامیت شده توسط Jaroslav Kysela
والد 498ade1a13
کامیت 3b89246778
6فایلهای تغییر یافته به همراه36 افزوده شده و 8 حذف شده

مشاهده پرونده

@@ -2279,9 +2279,20 @@ static int snd_cs4215_put_volume(struct snd_kcontrol *kcontrol,
struct snd_dbri *dbri = snd_kcontrol_chip(kcontrol);
struct dbri_streaminfo *info =
&dbri->stream_info[kcontrol->private_value];
unsigned int vol[2];
int changed = 0;
if (info->left_gain != ucontrol->value.integer.value[0]) {
vol[0] = ucontrol->value.integer.value[0];
vol[1] = ucontrol->value.integer.value[1];
if (kcontrol->private_value == DBRI_PLAY) {
if (vol[0] > DBRI_MAX_VOLUME || vol[1] > DBRI_MAX_VOLUME)
return -EINVAL;
} else {
if (vol[0] > DBRI_MAX_GAIN || vol[1] > DBRI_MAX_GAIN)
return -EINVAL;
}
if (info->left_gain !=
info->left_gain = ucontrol->value.integer.value[0];
changed = 1;
}