From: Dmitry Osipenko Date: Tue, 5 Jun 2018 12:12:32 +0000 (+0300) Subject: clk: tegra: emc: Avoid out-of-bounds bug X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=405fcacbd866cfe75733b94bacdef5bcb4aa6c6c;p=linux.git 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: Dmitry Osipenko Signed-off-by: Stephen Boyd --- diff --git a/drivers/clk/tegra/clk-emc.c b/drivers/clk/tegra/clk-emc.c index 5234acd30e898..0621a3a82ea6c 100644 --- a/drivers/clk/tegra/clk-emc.c +++ b/drivers/clk/tegra/clk-emc.c @@ -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; }