Skip to content
Commit c89c7e94 authored by Anssi Hannula's avatar Anssi Hannula Committed by Mark Brown
Browse files

ASoC: fsl_spdif: Fix integer overflow when calculating divisors



The calculation code does
u64 = (u32 - u32) * 100000;

The 64 bits are of no help here as the type is casted only after the
multiplication, and therefore the result may overflow, possibly causing
inoptimal or wrong clock setup in an unfortunate case (the maximum
result value of the first substraction is currently 47999).

Fix the code to cast before multiplication.

Signed-off-by: default avatarAnssi Hannula <anssi.hannula@iki.fi>
Acked-by: default avatarNicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent e9b383dc
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment