]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.46/memory-tegra-fix-integer-overflow-on-tick-value-calculation.patch
Linux 4.19.46
[thirdparty/kernel/stable-queue.git] / releases / 4.19.46 / memory-tegra-fix-integer-overflow-on-tick-value-calculation.patch
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
5
6 From: Dmitry Osipenko <digetx@gmail.com>
7
8 commit b906c056b6023c390f18347169071193fda57dde upstream.
9
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
13 reduced by two times.
14
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>
19
20 ---
21 drivers/memory/tegra/mc.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
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
27 u32 value;
28
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);
33
34 value = readl(mc->regs + MC_EMEM_ARB_CFG);