Received: by 10.223.185.116 with SMTP id b49csp3822153wrg; Mon, 26 Feb 2018 06:41:11 -0800 (PST) X-Google-Smtp-Source: AH8x227LO+AIrGW6A5jf6bOXzpp/Axgyh7Uz9NNBGPt6D61y6IyxUOo7JEXdmVemPoOesmQJaAN8 X-Received: by 10.101.101.206 with SMTP id y14mr8381636pgv.297.1519656071527; Mon, 26 Feb 2018 06:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519656071; cv=none; d=google.com; s=arc-20160816; b=ULEpC0VXNaHdTpVuIND/JXStTNjjpmLBOt3VJTXd9Oe4BAPby7t8O/52teEgtgCyta KkqCe7ew8JGqGWZi1wS7Suk5NYjyqWFoqN0zyBYtfrmQJiPQg1AXq0s7XGZ+M21J2sXK 2e0xos1AC7n9EUV7gWWGfUiXvlMByKc/6/A2QtSMsjRVq9XGpkzs4sPTyOtOl/gZA4gx auYzsFaTXFhtIQxb0hZ4LRpFtUWPL9nStkTnr2brF5Ud88sBqEF3evqi0rmKpXnJUdWV Bj9pxXlvnp0FqlHkc1IcZt2keg4MeuO2zF1oAmXszbBlIMdyTAJh8Y3bZbZiK/OT35t5 ebRw== 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=n69VCYPKeIt9YB2cIMuKLgfHW4pQfDN48G7jOGKWcqU=; b=HZhOe/LFFwYWO2PafuyFc8u9i1tPJiAOsXHYjJYUoIMJk81kUMH7HmvJAbEK9eGBwH TmbHJo1ARGFZXsxqb0sIJIxaII97Vz/Q60OBDPo5nlfx+q2rtJoh8GuTsRt2araLOrNo HUItjKoO1JM6P3Vb4MAW52dtNhPUEeJgubygddx/N+qCbyY/UvXeeofF5TkMgM3ml7eO aXX6aVbBtF9X0mBCITNV89w69i3K7S69hXn8FrDNABEUKl4mGYeMtckSikkRrJaGKKvu 1Yq/QA1WN57wZW7CzopHP3CXcWNuUC7qZp/8/XzZ/EDXFG/rTxGamOTWWEK5fcfuRJaS RpEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nqeROpOj; 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 w3si5577156pgb.258.2018.02.26.06.40.57; Mon, 26 Feb 2018 06:41:11 -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=nqeROpOj; 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 S1753937AbeBZOj6 (ORCPT + 99 others); Mon, 26 Feb 2018 09:39:58 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:39430 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753706AbeBZOj4 (ORCPT ); Mon, 26 Feb 2018 09:39:56 -0500 Received: by mail-qt0-f194.google.com with SMTP id f4so18989617qtj.6; Mon, 26 Feb 2018 06:39:56 -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=n69VCYPKeIt9YB2cIMuKLgfHW4pQfDN48G7jOGKWcqU=; b=nqeROpOjpfU0INarRVwl9eI4cqWW8poKDuIWXKXy4QWO5lbFwtzgXeTAjrW8Wf0gck hMv8HjlTPoT9nNlMWvJ+6M+AS+vKiOdN6WTURATFOAY4qfVLIQs/J8+earwe9OLiihOy F9m1f1YTGuJZ5tvQHniv+LOS4knwlvxnMFEKVg1JiY86ONGwhd0sgZrximoLY8GWhQb0 EWqE6BAKAtMNNHt051zME5lLIBxjiuBx2RNTrMJF5B5lc9lhdzFJFuKBGjHpDzii4WzY blhTc1P7GrzweeY8cbQ1iWHKkh80BhWHs6u1PCl4aP0AjeOTtVnvYC09K+bvH3vvZnwG bRzw== 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=n69VCYPKeIt9YB2cIMuKLgfHW4pQfDN48G7jOGKWcqU=; b=BAxLMO6hG2Tgb/pmowR9iI6AZ3tDLnw/PCSDKfchdPM98iyWxhRSo+Mnkal4sUrnhq S1nU7tWKHbliZ8T6j4rUFn4WPZInT/2JWX3Ke8xdMlaEo8Els+gi3mn5p2vJKT5D4tFq W+R9+HlXxhfgbY0yfY14n3lgQoCREu63eT1LPZfvjd1BTkMHhl6PUO/ar+2Kw9sDjwXM ql1ZhmK6djtiJMPe8f7QFsxF2l+AxNmx0wpQ5ChFW0UZDvc6qVo5nrN8NlfTqB6zUe1S HWTjY8jGHuvQB2w7U1yuNz++sE9O8Osgb8pGleu70gOOOoNg3U/LQppuJaDPisvqb6Y1 Fkew== X-Gm-Message-State: APf1xPD38T5yKObqkmBFE8sFKWK8FkOgpCNnpb1m3FgvofgnvoRUd572 oRB5ZUo4tb5/ilMS+0kzRu6V9kLZ1Mc/+BLNncU= X-Received: by 10.237.48.229 with SMTP id 92mr6852354qtf.39.1519655996037; Mon, 26 Feb 2018 06:39:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Mon, 26 Feb 2018 06:39:55 -0800 (PST) In-Reply-To: <20180226143413.44134-3-Evgeniy.Didin@synopsys.com> References: <20180226143413.44134-1-Evgeniy.Didin@synopsys.com> <20180226143413.44134-3-Evgeniy.Didin@synopsys.com> From: Andy Shevchenko Date: Mon, 26 Feb 2018 16:39:55 +0200 Message-ID: Subject: Re: [PATCH 2/2 v3] mmc: dw_mmc: Fix the CTO overflow calculation for 32-bit systems To: Evgeniy Didin Cc: linux-mmc@vger.kernel.org, Alexey Brodkin , Eugeniy Paltsev , Douglas Anderson , Ulf Hansson , Linux Kernel Mailing List , linux-snps-arc@lists.infradead.org, Stable , Vineet Gupta 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 Mon, Feb 26, 2018 at 4:34 PM, Evgeniy Didin wrote: > In commit 4c2357f57dd5 ("mmc: dw_mmc: Fix the CTO timeout calculation") > have been made changes which can cause multiply overflow for 32-bit systems. > The value of cto_ms is lower the drto_ms, but nevertheless overflow can occur. > Lets cast this multiply to u64 type which prevents overflow. > - cto_ms = DIV_ROUND_UP(MSEC_PER_SEC * cto_clks * cto_div, host->bus_hz); > + > + cto_ms = DIV_ROUND_UP((u64)MSEC_PER_SEC * cto_clks * cto_div, host->bus_hz); IIRC, someone commented on this or similar, i.e. DIV_ROUND_UP_ULL() ? -- With Best Regards, Andy Shevchenko