summaryrefslogtreecommitdiffstats
path: root/drivers/memory
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2019-04-12 01:12:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-25 18:23:32 +0200
commit5e011f3319fe1a9631ac0dafba91a88cc3427965 (patch)
treee4cd6025d8497068ab80aaf705b7c9e3a831c12d /drivers/memory
parentfb8c9c900d4e08bb3ca395ae716a33becf75d674 (diff)
downloadlinux-stable-5e011f3319fe1a9631ac0dafba91a88cc3427965.tar.gz
linux-stable-5e011f3319fe1a9631ac0dafba91a88cc3427965.tar.bz2
linux-stable-5e011f3319fe1a9631ac0dafba91a88cc3427965.zip
memory: tegra: Fix integer overflow on tick value calculation
commit b906c056b6023c390f18347169071193fda57dde upstream. Multiplying the Memory Controller clock rate by the tick count results in an integer overflow and in result the truncated tick value is being programmed into hardware, such that the GR3D memory client performance is reduced by two times. Cc: stable <stable@vger.kernel.org> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/memory')
-rw-r--r--drivers/memory/tegra/mc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index bd25faf6d13d..c8f16666256c 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -280,7 +280,7 @@ static int tegra_mc_setup_latency_allowance(struct tegra_mc *mc)
u32 value;
/* compute the number of MC clock cycles per tick */
- tick = mc->tick * clk_get_rate(mc->clk);
+ tick = (unsigned long long)mc->tick * clk_get_rate(mc->clk);
do_div(tick, NSEC_PER_SEC);
value = readl(mc->regs + MC_EMEM_ARB_CFG);