]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ASoC: codecs: wcd9335: Remove potential undefined behavior in wcd9335_slimbus_irq()
authorJosh Poimboeuf <jpoimboe@kernel.org>
Mon, 9 Mar 2026 16:03:06 +0000 (09:03 -0700)
committerMark Brown <broonie@kernel.org>
Mon, 9 Mar 2026 19:48:26 +0000 (19:48 +0000)
commited0313223ce6514dbd39c049e25f702980d7e3cc
treea7884b0d4e7fa7d44a9e3b926f1736bff1ac1801
parent87e49eb0918154f64f736d5271e9e3fe566f82b1
ASoC: codecs: wcd9335: Remove potential undefined behavior in wcd9335_slimbus_irq()

If 'port_id' is negative, the shift counts in wcd9335_slimbus_irq() also
become negative, resulting in undefined behavior due to shift out of
bounds.

That appears to be not possible, but with UBSAN enabled, Clang's range
analysis isn't always able to determine that and generates undefined
behavior.

As a result the code generation isn't optimal, and undefined behavior
should be avoided regardless.  Improve code generation and remove the
undefined behavior by converting the signed variables to unsigned.

Fixes the following warning:

  sound/soc/codecs/wcd9335.o: warning: objtool: wcd9335_slimbus_irq() falls through to next function __cfi_wcd9335_set_channel_map()

This is very similar to a previous fix to wcd934x with commit
060aed9c0093 ("objtool, ASoC: codecs: wcd934x: Remove potential
undefined behavior in wcd934x_slim_irq_handler()").

Cc: Srinivas Kandagatla <srini@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Closes: https://lore.kernel.org/a426d669-58bb-4be1-9eaa-6f3d83109e2d@app.fastmail.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://patch.msgid.link/08dbb63519ef31a5457e07673b7b256fecb5989b.1773071992.git.jpoimboe@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wcd9335.c