]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate()
authorLuo Yifan <luoyifan@cmss.chinamobile.com>
Wed, 6 Nov 2024 01:46:54 +0000 (09:46 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:47:42 +0000 (19:47 +0100)
commitddd61392263d87cd94ce2337fa13eda8c8ac612b
tree6463dc4b9c043e83c8a0d8febab2837436525a1d
parenta8ebe0a225271cc3220d864641c3139a7e4f995f
ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate()

[ Upstream commit 63c1c87993e0e5bb11bced3d8224446a2bc62338 ]

This patch checks if div is less than or equal to zero (div <= 0). If
div is zero or negative, the function returns -EINVAL, ensuring the
division operation (*prate / div) is safe to perform.

Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
Link: https://patch.msgid.link/20241106014654.206860-1-luoyifan@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/stm/stm32_sai_sub.c