ASoC: max98090: Move check for invalid values before casting in max98090_put_enab_tlv()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Thu, 19 May 2022 22:31:26 +0000 (01:31 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:25:57 +0000 (10:25 +0200)
commit5348e2eea76f749eb8b15cb6f288fdef2f5a4d79
tree3a74f3df3f945e7120e1887f4319ecc651c9e550
parent1b66a533c47d29b38af8e05fbb53b609a5ba3a4e
ASoC: max98090: Move check for invalid values before casting in max98090_put_enab_tlv()

[ Upstream commit f7a344468105ef8c54086dfdc800e6f5a8417d3e ]

Validation of signed input should be done before casting to unsigned int.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Suggested-by: Mark Brown <broonie@kernel.org>
Fixes: 2fbe467bcbfc ("ASoC: max98090: Reject invalid values in custom control put()")
Link: https://lore.kernel.org/r/1652999486-29653-1-git-send-email-khoroshilov@ispras.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/codecs/max98090.c