Skip to content
Unverified Commit 375e2c35 authored by Tuo Li's avatar Tuo Li Committed by Mark Brown
Browse files

ALSA: rockchip_i2s: fix a possible divide-by-zero bug in rockchip_i2s_hw_params()



The variable bclk_rate is checked in:
  if (bclk_rate && mclk_rate % bclk_rate)

This indicates that bclk_rate can be zero.
If so, a divide-by-zero bug will occur:
  div_bclk = mclk_rate / bclk_rate;

To fix this possible bug, the function returns -EINVAL when bclk_rate is
zero.

Signed-off-by: default avatarTuo Li <tuoli96@outlook.com>
Link: https://lore.kernel.org/r/TY2PR04MB4029799E60A5BCAAD5B7B5BBB8280@TY2PR04MB4029.apcprd04.prod.outlook.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2a4b91a2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment