Received: by 10.223.185.116 with SMTP id b49csp1055454wrg; Wed, 21 Feb 2018 11:17:28 -0800 (PST) X-Google-Smtp-Source: AH8x225sUrG1E3CPWe/MdeWTqkwlvxjeETZmEN3gb2o5wndE4G+1kZqkBnU5Ycc5TTjVczAMv/Gu X-Received: by 10.99.98.5 with SMTP id w5mr3571791pgb.307.1519240648789; Wed, 21 Feb 2018 11:17:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519240648; cv=none; d=google.com; s=arc-20160816; b=k1NuwEKRHl0aw9oXHh3idJSu/1U756W++5+65b0BwzP91KUN1yqAsBkEijg2e6VQQq PGvDoZsXGt4A6sWiknrzQCOXWkX9hSjc08n4ukY7d6nfMIk0b3toD3x7oU4SLY6WvUCN QGAUXNqBWrLAew/LjaXKCDEGhst9ObtdXQz4aRwLorijvZhkNm3QvAv9BUp+VlzMMPhX urYrvWx9aBJrPoGOXh9yk807Aax7UtpPzRBpuDsp9wyt5gTpLHg2FsAk3ZJ3gn5PVVmD QL4HW+OR6XyLI9DyKpLGleVBssmXXQbVmzhp7kUyiMCbqZpP4dSUrjaruQgf9z/6SvgJ deWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=yyvg98aSzrN9Wnb8YssRjQhdpgqcyg45rzhLyi9fxZQ=; b=YpZq8Ip+Yl/rGIgM8E7mW4LfUnHM2fk0DFBJlV6yozWc8GaOmZgI/rJP6/jXhBaOTI T9IMad0kJwnNFj1++Sma+5Wfu71WA82srvdoOGyQjjdFHqotVu2uYoNOdKMrAf3pqSCS MJezDdwiBWmnts9HbCPf7861ca5wdWe6payOsw1dFC6DPEfKkdNIkchD+FCLcEKJWJRP g9vWCGJ2XOzVQtlnSBFt9m787reU6FerLpdYxk8UozlYLXfNXg6I2ZBMziG4FRXRSUzY Vm418peYWZLnzFolUzGAZ+C8iV9iXEMVf8WuSz5jZ/N6knXzSriPJC+i56T1C/Y/IMZm mgww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E+SPMV4V; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v124si3273125pfb.391.2018.02.21.11.17.14; Wed, 21 Feb 2018 11:17:28 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E+SPMV4V; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752094AbeBUTQn (ORCPT + 99 others); Wed, 21 Feb 2018 14:16:43 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:46653 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751702AbeBUTQ1 (ORCPT ); Wed, 21 Feb 2018 14:16:27 -0500 Received: by mail-qt0-f194.google.com with SMTP id u6so3301110qtg.13; Wed, 21 Feb 2018 11:16:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yyvg98aSzrN9Wnb8YssRjQhdpgqcyg45rzhLyi9fxZQ=; b=E+SPMV4VahT/uD82JOMlPhG4w4SLD3wVqgtPS0OyqrCgrWB0euzQzNqpSvmOJEoZUG N5BV4wvD5+f3d65ycORDBqCaXfl78VQLvhDp4YNgQoX1UWJn/JWSm0RdeDlMVhKC8kwk 6/UvTyg6DQKJIkdPFeeqzdLa0Ziu09TNP0+6iFkseWlTuBPN89fUd0jNgXRdxCU4eaVE pvbjdRI+OutwvcLjE38p8A+r3COA+YGwuvlfJ+T19YsTNbJVtKYfoy9uC5p7VKGlsCPU Gs4XWlOnDzYosJVkIRm/6AW3y+6zlfJi0y8bszYo/pwpR+3cSbTiq4hs7uJJtU15vSw8 wC+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yyvg98aSzrN9Wnb8YssRjQhdpgqcyg45rzhLyi9fxZQ=; b=XHfejGTAEU4ZHvPsuf3o1ejfbPBXkJqm+vDSo2iq3RE5ocKO/q9/8KC8C1GKZDo5sH meJ/3SLKIQgJYZaJLA835QXuIlFR7QQWrLRpx1ACeo6xqlyVGdzBKfHIXwMGyhMZm8b/ grLC78kolqN81IYgtwvouSDvexe/xWJIKUSnQXqEMA2aZptUc+JtdR8/oAI9AcdY4n9Q J8auMtvSoy/FX00TaWYrisse8hMbjJRWg3kgj16+P+kiwHYXSWAdqVLVkcWFXhX9L7vH h6sTjo5NLhy5EngjwsbIMQCnsjGiTaBLx6aPF7Age1b01aUZeD1z8iPnK/azk33w31Bg zPew== X-Gm-Message-State: APf1xPB/iSDknVn9/KBSKJwv1AxhzkecWf7yE9pI0/Vtj1wHlPBIktmw Wlbab7BwIfOOTKtnkVWwWy1tYOpODYXFANMiCps= X-Received: by 10.200.54.213 with SMTP id b21mr7183539qtc.187.1519240586680; Wed, 21 Feb 2018 11:16:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Wed, 21 Feb 2018 11:16:26 -0800 (PST) In-Reply-To: <20180221175734.39114-1-Evgeniy.Didin@synopsys.com> References: <20180221175734.39114-1-Evgeniy.Didin@synopsys.com> From: Andy Shevchenko Date: Wed, 21 Feb 2018 21:16:26 +0200 Message-ID: Subject: Re: [PATCH] mmc: dw_mmc: Fix the DTO timeout overflow calculation for 32-bit systems To: Evgeniy Didin Cc: linux-mmc@vger.kernel.org, Alexey Brodkin , Douglas Anderson , Ulf Hansson , Linux Kernel Mailing List , linux-snps-arc@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 21, 2018 at 7:57 PM, Evgeniy Didin wrote: > 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 > --- 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); Does the driver use uint64_t elsewhere? Or simple u64? -- With Best Regards, Andy Shevchenko