提交 405fcacb 编写于 作者: D Dmitry Osipenko 提交者: Stephen Boyd

clk: tegra: emc: Avoid out-of-bounds bug

Apparently there was an attempt to avoid out-of-bounds accesses when there
is only one memory timing available, but there is a typo in the code that
neglects that attempt.
Signed-off-by: NDmitry Osipenko <digetx@gmail.com>
Signed-off-by: NStephen Boyd <sboyd@kernel.org>
上级 ce397d21
...@@ -132,7 +132,7 @@ static int emc_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) ...@@ -132,7 +132,7 @@ static int emc_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
timing = tegra->timings + i; timing = tegra->timings + i;
if (timing->rate > req->max_rate) { if (timing->rate > req->max_rate) {
i = min(i, 1); i = max(i, 1);
req->rate = tegra->timings[i - 1].rate; req->rate = tegra->timings[i - 1].rate;
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册