mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 21:23:23 +00:00
ALSA: hda - Fix possible zero-division
Check the TLV db scale result before actually dividing in vmaster slave init code. Also mask TLV_DB_SCALE_MUTE bit so that the right value is obtained even if this bit is set by the codec driver. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
504333df8b
commit
a4e7a12168
@ -2676,8 +2676,13 @@ static int get_kctl_0dB_offset(struct snd_kcontrol *kctl)
|
|||||||
set_fs(fs);
|
set_fs(fs);
|
||||||
} else if (kctl->vd[0].access & SNDRV_CTL_ELEM_ACCESS_TLV_READ)
|
} else if (kctl->vd[0].access & SNDRV_CTL_ELEM_ACCESS_TLV_READ)
|
||||||
tlv = kctl->tlv.p;
|
tlv = kctl->tlv.p;
|
||||||
if (tlv && tlv[0] == SNDRV_CTL_TLVT_DB_SCALE)
|
if (tlv && tlv[0] == SNDRV_CTL_TLVT_DB_SCALE) {
|
||||||
val = -tlv[2] / tlv[3];
|
int step = tlv[3];
|
||||||
|
step &= ~TLV_DB_SCALE_MUTE;
|
||||||
|
if (!step)
|
||||||
|
return -1;
|
||||||
|
val = -tlv[2] / step;
|
||||||
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user