1 From b906c056b6023c390f18347169071193fda57dde Mon Sep 17 00:00:00 2001
2 From: Dmitry Osipenko <digetx@gmail.com>
3 Date: Fri, 12 Apr 2019 01:12:48 +0300
4 Subject: memory: tegra: Fix integer overflow on tick value calculation
6 From: Dmitry Osipenko <digetx@gmail.com>
8 commit b906c056b6023c390f18347169071193fda57dde upstream.
10 Multiplying the Memory Controller clock rate by the tick count results
11 in an integer overflow and in result the truncated tick value is being
12 programmed into hardware, such that the GR3D memory client performance is
15 Cc: stable <stable@vger.kernel.org>
16 Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
17 Signed-off-by: Thierry Reding <treding@nvidia.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 drivers/memory/tegra/mc.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
24 --- a/drivers/memory/tegra/mc.c
25 +++ b/drivers/memory/tegra/mc.c
26 @@ -280,7 +280,7 @@ static int tegra_mc_setup_latency_allowa
29 /* compute the number of MC clock cycles per tick */
30 - tick = mc->tick * clk_get_rate(mc->clk);
31 + tick = (unsigned long long)mc->tick * clk_get_rate(mc->clk);
32 do_div(tick, NSEC_PER_SEC);
34 value = readl(mc->regs + MC_EMEM_ARB_CFG);