linux/sound/pci/ac97
Takashi Iwai a4cd58f664 ALSA: ac97: Fix incorrect bit shift at AC97-SPSA control write
commit 7194eda1ba upstream.

The function snd_ac97_put_spsa() gets the bit shift value from the
associated private_value, but it extracts too much; the current code
extracts 8 bit values in bits 8-15, but this is a combination of two
nibbles (bits 8-11 and bits 12-15) for left and right shifts.
Due to the incorrect bits extraction, the actual shift may go beyond
the 32bit value, as spotted recently by UBSAN check:
 UBSAN: Undefined behaviour in sound/pci/ac97/ac97_codec.c:836:7
 shift exponent 68 is too large for 32-bit type 'int'

This patch fixes the shift value extraction by masking the properly
with 0x0f instead of 0xff.

Reported-and-tested-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2019-02-11 17:54:10 +00:00
..
ac97_codec.c ALSA: ac97: Fix incorrect bit shift at AC97-SPSA control write 2019-02-11 17:54:10 +00:00
ac97_id.h ALSA: ac97: add AC97 STMicroelectronics' codecs 2010-01-10 19:03:09 +01:00
ac97_local.h [ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz 2007-10-16 16:51:18 +02:00
ac97_patch.c ALSA: ac97: Use standard printk helpers 2014-02-26 16:45:23 +01:00
ac97_patch.h [ALSA] ac97_patch: compilation warning fix 2008-01-31 17:29:11 +01:00
ac97_pcm.c ALSA: ac97: Use standard printk helpers 2014-02-26 16:45:23 +01:00
ac97_proc.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
Makefile [ALSA] Make ak4531 local to ens1370 driver 2008-05-30 09:26:09 +02:00