Received: by 10.223.185.116 with SMTP id b49csp1051481wrg; Wed, 21 Feb 2018 11:13:32 -0800 (PST) X-Google-Smtp-Source: AH8x225B7BORPcWgJkVPPjxqJ+rn+6S8gVPo831V8QjNFhckEAVVI+nOuYeREtqNOlY61DewxzJS X-Received: by 2002:a17:902:3a1:: with SMTP id d30-v6mr3967401pld.409.1519240411987; Wed, 21 Feb 2018 11:13:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519240411; cv=none; d=google.com; s=arc-20160816; b=diZC9/tJkn7zYQX+XlyB2rvaBx+GMVrdNhmPUPZ0wh6DtYmO5XzuWImljuizZhBMxf wI4RnSEmestiL9VxRwOOEeK33DeYBEAOxv6nm66L618Y6qnVzft0aBhHEFLMCFXtC472 GuBmNicrGHwEnZzse9/ENz7yA6tkWzTjUjx+cSooZevymetl5NjpcQB2fm8cNuQybc7e gRxXehce+wO8MbQUWsWcbx7OnCc+Rzdjkq7IVRf8osyxzwEbbIzoOIq6pGO/k3cdellZ qUjIyjIAyZwnKwAfYFPG7o4u6vZOkxOkW1vGovPCgW09stn7LD7vvySQo3t6qwWvQu2Y KbDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=qA34fkO0OIqSfP53g7X2jMnVDJHat8+p7I4+GqPtSZM=; b=SUX43M9r3Gn43DCG4yFU4v1TuVFRWUi77Tm+/Na+miUrcHnZdDNJUVj+percoYV+bU VJSCPF5EABoB6chW0Ms7YPYhF3bRJ06oReOXfC8yimuXzm/5l3JVBBrcIaBoR+lpTO/X nnoeNv+lvT9IaYgqbQyGmhqlxUVQNfvur+pyHilR/lorq+gXdKb5ak1RZJGSKehYfvSX ikULRQd2MJSZnpA/fdeLTpUElN2aTbN87aa6SR7fFK2Ih9whltg6BUYtbfd4Y1GKm2qW T3E1G0+fahC3C9YWV1BML6b8amQoBKuJDRbit/kvSPGTiWucRFirJ0nrr6RUGSttWTgx LbGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l59-v6si154076plb.391.2018.02.21.11.13.17; Wed, 21 Feb 2018 11:13:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938808AbeBUR55 (ORCPT + 99 others); Wed, 21 Feb 2018 12:57:57 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:36953 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932551AbeBUR5x (ORCPT ); Wed, 21 Feb 2018 12:57:53 -0500 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 8295F10C05A3; Wed, 21 Feb 2018 09:57:52 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 6EF1A37CD; Wed, 21 Feb 2018 09:57:52 -0800 (PST) Received: from ru20arcgnu1.internal.synopsys.com (ru20arcgnu1.internal.synopsys.com [10.121.9.48]) by mailhost.synopsys.com (Postfix) with ESMTP id 70AC137C1; Wed, 21 Feb 2018 09:57:50 -0800 (PST) From: Evgeniy Didin To: linux-mmc@vger.kernel.org Cc: Evgeniy Didin , Alexey Brodkin , Douglas Anderson , Ulf Hansson , 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 Message-Id: <20180221175734.39114-1-Evgeniy.Didin@synopsys.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 CC: Alexey Brodkin CC: Douglas Anderson CC: Ulf Hansson 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