android_kernel_oneplus_msm8998/sound
Rohit kumar 4ed2bedbea ASoC: Fix UBSAN warning at snd_soc_get/put_volsw_sx()
In functions snd_soc_get_volsw_sx() or snd_soc_put_volsw_sx(),
if the result of (min + max) is negative, then fls() returns
signed integer with value as 32. This leads to signed integer
overflow as complete operation is considered as signed integer.

UBSAN: Undefined behaviour in sound/soc/soc-ops.c:382:50
signed integer overflow:
-2147483648 - 1 cannot be represented in type 'int'
Call trace:
[<ffffff852f746fe4>] __dump_stack lib/dump_stack.c:15 [inline]
[<ffffff852f746fe4>] dump_stack+0xec/0x158 lib/dump_stack.c:51
[<ffffff852f7b5f3c>] ubsan_epilogue+0x18/0x50 lib/ubsan.c:164
[<ffffff852f7b6840>] handle_overflow+0xf8/0x130 lib/ubsan.c:195
[<ffffff852f7b68f0>] __ubsan_handle_sub_overflow+0x34/0x44 lib/ubsan.c:211
[<ffffff85307971a0>] snd_soc_get_volsw_sx+0x1a8/0x1f8 sound/soc/soc-ops.c:382

Typecast the operation to unsigned int to fix the issue.

Change-Id: I40d070b1357f016eb1622146180e4abb340e5d00
Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Git-commit: ae7d1247d8673ebfd686b17e759d4be391165368
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
2018-11-22 21:31:44 -08:00
..
aoa
arm
atmel
core Merge android-4.4.153 (5e24b4e) into msm-4.4 2018-08-28 17:28:39 +05:30
drivers ALSA: aloop: Add missing cable lock to ctl API callbacks 2018-05-16 10:06:47 +02:00
firewire ALSA: firewire-digi00x: handle all MIDI messages on streaming packets 2018-03-22 09:23:24 +01:00
hda ALSA: hda: Drop useless WARN_ON() 2018-01-02 20:33:22 +01:00
i2c
isa ALSA: msnd: Optimize / harden DSP and MIDI loops 2017-09-13 14:09:46 -07:00
mips
oss
parisc
pci ALSA: hda: Correct Asrock B85M-ITX power_save blacklist entry 2018-08-22 07:48:36 +02:00
pcmcia ALSA: vxpocket: Fix invalid endian conversions 2018-08-22 07:48:36 +02:00
ppc ALSA: ppc/awacs: shut up maybe-uninitialized warning 2017-05-08 07:46:01 +02:00
sh
soc ASoC: Fix UBSAN warning at snd_soc_get/put_volsw_sx() 2018-11-22 21:31:44 -08:00
sparc
spi
synth
usb Merge android-4.4.146 (13962260) into msm-4.4 2018-08-07 15:36:56 +05:30
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c
sound_firmware.c