From: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
To: linux-mmc@vger.kernel.org
Cc: Evgeniy Didin <Evgeniy.Didin@synopsys.com>,
Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
Douglas Anderson <dianders@chromium.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org
Subject: [PATCH] mmc: dw_mmc: Fix the DTO timeout overflow calculation for 32-bit systems
Date: Wed, 21 Feb 2018 20:57:33 +0300 [thread overview]
Message-ID: <20180221175734.39114-1-Evgeniy.Didin@synopsys.com> (raw)
In commit 9d9491a7da2a ("mmc: dw_mmc: Fix the DTO timeout calculation") have been made
changes which can cause multiply overflow for 32-bit systems. It was caught on arc/hsdk board
when "drto_ms" should be 671, but it was 70 and that caused a flow of stack-traces just copying
file from mmc.
Lets cast this multiply to long long int which prevents overflow.
Signed-off-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
CC: Alexey Brodkin <abrodkin@synopsys.com>
CC: Douglas Anderson <dianders@chromium.org>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: linux-kernel@vger.kernel.org
CC: linux-snps-arc@lists.infradead.org
---
drivers/mmc/host/dw_mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 0aa39975f33b..1a0b9751c67c 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1944,7 +1944,7 @@ static void dw_mci_set_drto(struct dw_mci *host)
drto_div = (mci_readl(host, CLKDIV) & 0xff) * 2;
if (drto_div == 0)
drto_div = 1;
- drto_ms = DIV_ROUND_UP(MSEC_PER_SEC * drto_clks * drto_div,
+ drto_ms = DIV_ROUND_UP((uint64_t)MSEC_PER_SEC * drto_clks * drto_div,
host->bus_hz);
/* add a bit spare time */
--
2.11.0
next reply other threads:[~2018-02-21 17:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 17:57 Evgeniy Didin [this message]
2018-02-21 19:16 ` Andy Shevchenko
2018-02-21 19:24 ` Vineet Gupta
2018-02-23 1:14 ` kbuild test robot
2018-02-23 8:34 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180221175734.39114-1-Evgeniy.Didin@synopsys.com \
--to=evgeniy.didin@synopsys.com \
--cc=Alexey.Brodkin@synopsys.com \
--cc=dianders@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®