diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-03-29 09:19:38 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-03-29 09:20:39 +0200 |
commit | 467126460818e287aa92c73232c38453ec2ab013 (patch) | |
tree | bc02161edee275b50b8d88e267e1164319a4b609 | |
parent | 55440e4e37540305997b7e93d319ddce97a9cfb1 (diff) | |
download | op-kernel-dev-467126460818e287aa92c73232c38453ec2ab013.zip op-kernel-dev-467126460818e287aa92c73232c38453ec2ab013.tar.gz |
ALSA: hda - Report errors when invalid values are passed to snd_hda_amp_*()
The values should be in 8 bits.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/hda_codec.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index d72bcff..d1424e7 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1461,6 +1461,8 @@ int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch, info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, direction, idx)); if (!info) return 0; + if (snd_BUG_ON(mask & ~0xff)) + mask &= 0xff; val &= mask; val |= get_vol_mute(codec, info, nid, ch, direction, idx) & ~mask; if (info->vol[ch] == val) @@ -1486,6 +1488,9 @@ int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid, int direction, int idx, int mask, int val) { int ch, ret = 0; + + if (snd_BUG_ON(mask & ~0xff)) + mask &= 0xff; for (ch = 0; ch < 2; ch++) ret |= snd_hda_codec_amp_update(codec, nid, ch, direction, idx, mask, val); |