android_kernel_oneplus_msm8998/sound
Rohit kumar 1e9e68e4ef 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-12-26 07:58:34 +01:00
..
aoa ALSA: aoa-soundbus: Switch to dev_pm_ops 2015-08-05 16:47:47 +02:00
arm ASoC: pxa: pxa-pcm-lib: switch over to snd-soc-dmaengine-pcm 2015-09-30 23:21:16 +01:00
atmel ALSA: sound/atmel/ac97c.c: remove unused variable 2015-05-20 06:18:25 +02:00
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 ALSA: ak4xxx-adda: Drop unnecessary ifdef CONFIG_PROC_FS 2015-05-29 07:51:23 +02:00
isa ALSA: msnd: Optimize / harden DSP and MIDI loops 2017-09-13 14:09:46 -07:00
mips ALSA: mips: let SND_SGI_O2 select SND_PCM 2015-06-15 13:21:58 +02:00
oss sound: oss/sb_audio: use swap() in sb_audio_close() 2015-06-12 20:46:29 +02:00
parisc ALSA: Include linux/io.h instead of asm/io.h 2015-01-28 16:49:33 +01:00
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 ALSA: Include linux/io.h instead of asm/io.h 2015-01-28 16:49:33 +01:00
soc ASoC: Fix UBSAN warning at snd_soc_get/put_volsw_sx() 2018-12-26 07:58:34 +01:00
sparc ALSA: Add missing dependency on CONFIG_SND_TIMER 2016-02-17 12:30:58 -08:00
spi ALSA: spi: Convert to snd_card_new() with a device pointer 2014-02-14 08:14:08 +01:00
synth ALSA: synth: Fix conflicting OSS device registration on AWE32 2015-10-05 16:55:09 +02:00
usb Merge android-4.4.146 (13962260) into msm-4.4 2018-08-07 15:36:56 +05:30
ac97_bus.c ASoC: Updates for v4.3 2015-08-31 16:25:22 +02:00
Kconfig ALSA: hda - Make snd_hda_bus_type public 2015-03-23 13:15:51 +01:00
last.c ALSA: Remove the last mention of SNDRV_MAIN_OBJECT_FILE 2012-09-03 10:07:23 +02:00
Makefile ALSA: hda - Make snd_hda_bus_type public 2015-03-23 13:15:51 +01:00
sound_core.c sound: fix check for error condition of register_chrdev() 2015-11-07 11:14:30 +01:00
sound_firmware.c sound: sound_firmware: Fix invalid use of vfs_read() 2015-05-26 13:48:58 +02:00