Skip to content
Commit 00f8f70a authored by Zichen Xie's avatar Zichen Xie Committed by Stephen Boyd
Browse files

clk: sophgo: avoid integer overflow in sg2042_pll_recalc_rate()



This was found by a static analyzer.
There may be a potential integer overflow issue in
sg2042_pll_recalc_rate(). numerator is defined as u64 while
parent_rate is defined as unsigned long and ctrl_table.fbdiv
is defined as unsigned int. On 32-bit machine, the result of
the calculation will be limited to "u32" without correct casting.
Integer overflow may occur on high-performance systems.

Fixes: 48cf7e01 ("clk: sophgo: Add SG2042 clock driver")
Signed-off-by: default avatarZichen Xie <zichenxie0106@gmail.com>
Reviewed-by: default avatarChen Wang <unicorn_wang@outlook.com>
Link: https://lore.kernel.org/r/20241023145146.13130-1-zichenxie0106@gmail.com


Reviewed-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent b961b659
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment