Skip to content

Commit

Permalink
clk: tegra: emc: Avoid out-of-bounds bug
Browse files Browse the repository at this point in the history
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: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
  • Loading branch information
Dmitry Osipenko authored and Stephen Boyd committed Jul 9, 2018
1 parent ce397d2 commit 405fcac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/clk/tegra/clk-emc.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static int emc_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
timing = tegra->timings + i;

if (timing->rate > req->max_rate) {
i = min(i, 1);
i = max(i, 1);
req->rate = tegra->timings[i - 1].rate;
return 0;
}
Expand Down

0 comments on commit 405fcac

Please sign in to comment.