From patchwork Mon Oct 17 08:18:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 9380679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70F1B6086B for ; Mon, 17 Oct 2016 21:47:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CEB428FE4 for ; Mon, 17 Oct 2016 21:47:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DBD328FF2; Mon, 17 Oct 2016 21:47:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B121928FE9 for ; Mon, 17 Oct 2016 21:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932620AbcJQVrc (ORCPT ); Mon, 17 Oct 2016 17:47:32 -0400 Received: from mail-db5eur01on0075.outbound.protection.outlook.com ([104.47.2.75]:44704 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934797AbcJQVr1 (ORCPT ); Mon, 17 Oct 2016 17:47:27 -0400 X-Greylist: delayed 35931 seconds by postgrey-1.27 at vger.kernel.org; Mon, 17 Oct 2016 17:47:26 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=J7MvxrxzXdZigjiz3v6zXAdQKpK7QIt+HV+oLk4/6vQ=; b=C0XOPB5dvjh9kDnj84wO9v8jMlZl9uXhJhD5MSwpVIfrj4qExodckxKHXmncgPDvGwicLna7fkPhoBS7yRO0TbraAgyyD4sVUHjOYU6Q0LSHHCfVYSQ6MdA6/Wf4c59qzm8kww2OoaOVrhSoYpTURuN7oi2/GFt90JGlYyp0Aps= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=haibo.chen@nxp.com; Received: from b51421-server.ap.freescale.net (199.59.230.102) by DB6PR0401MB2326.eurprd04.prod.outlook.com (10.168.54.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.8; Mon, 17 Oct 2016 08:13:23 +0000 From: Haibo Chen To: , , CC: , , Subject: [PATCH v2] mmc: sdhci: cast unsigned int to unsigned long long to avoid unexpeted error Date: Mon, 17 Oct 2016 16:18:37 +0800 Message-ID: <1476692317-26845-1-git-send-email-haibo.chen@nxp.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [199.59.230.102] X-ClientProxiedBy: KL1PR03CA0004.apcprd03.prod.outlook.com (10.165.63.14) To DB6PR0401MB2326.eurprd04.prod.outlook.com (10.168.54.151) X-MS-Office365-Filtering-Correlation-Id: 8c0fa116-6289-4d30-18c3-08d3f6657a47 X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2326; 2:I0JMDVZeQ7tchwD4t1EJl2iZy1VcvP04bJxn218U0wJMAtqc3xhbFPHdw+EjuXh+kbKmXPhU5viz1b4soaheOyg/RoJ/VrtmoWsQGje9myl8kOwz08PStek1srXsWZpn4qm0q51ng9jhVIh03WwBJEqd/KHWh6S8RU5r1Exsw8ryJwZomfjsu3A9ezBqgVLOuy0JUY0NHuLUhGSQ9mpaWg==; 3:ZtZFEUkDf1ck0s+QWSRFdpkn/xM1Ps7N30CDqjSTEMrl8RbVcqOEnCFVJN4khxUfRducatS50MqhLNSRuANQpPjyxCj9z5lYHAfKuIfbGeyA8e3DEmPvbVBRwV6ZCNLTx5WTA4gmdGjc7DbdKZT+gg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0401MB2326; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2326; 25:3ToKOp66QgPsqR7Bk3dyIROrynqjQxx2QcU1aybDpK+bDeZznsbIHzUQu6QyYUtV1WPQYhkazXpCAXz9SvzJ0m2Zk7VgReRg6PKhaxruTESpW8S/lNTLG1njRgpKTKK8SSlQz2BF68sZKAOPYhCFiZDPEJS+BXZzbtGg5B8JRZ9nJ3RkG0QXUFJScZgP4FsDdLtGRssG6k8RlQQQQ4zsFOJW204RbpTIMK6vl8189iMMSEdwREiF9fKJjMww8igJlBpJzhFglCS3kZjx2LBJd8y04ijHKHBziGEKEwN+3vDqkrM3gRUc/l52JBXjzhYYnoDMDXojxOJNqDMw9XNFecw/HlY4JKedDrbkiEGvaZ20WVMdAIM8P0utUT0zeJ2TPZu5MFwY5RcurtCOI9fdPvMjitpZzwrYuZ6OX7Y+yN72gitgG1CVcd/dNAW6mZj9pI54dz4lpSMRNS6fwIzxJvh/xyK0bFSa3FHeulkQC/pPYPriJWP/o31u0yTYQu+oBMri5vY3nLDVMCJQTBVhQzLCpYRPw8aRZr/q8vhJJRfLBmg4oV4vC8Ljcp4/AFdiuqZMmtV7MM+pMIUIdUuRRHMILhsaTrdAK1VBkh3671Kn6P59w0FFXDeZalc+nrwGm9xsIzyWgF2KhG6/lBMNCj1odJUith3bLB0Fw3j4z3oV9ng3po1Q0HxMAL0pS91jePZigg6UzkO6yUcDDbYyTkLwmGx7GwxLSfFWEX0bBaE= X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2326; 31:IFc15vVSTe5fRvIGzmNld5t4nfnKe4kE3IcE0whc4e2IB7dwVe6qCHMseZPaNPgLt/CXjmLkXvjyE/+2HWXUzmwv73/t6UHfZpJy4AityVmOOGuGrJ6xrRjoU+CErGWghQN7wSiFkw4czxwGkqtTWF8n9DT0c1YgoTr2VZF12JNzgzAmHQwcd9J+LlP2qVcvgYMp7YTKXypmtnElH4457PaNdceUaTzwofe8gDEF0cLJhWrc+9ljUqA5XXznGbBH1it9FBHxCb1DfLhmWt6vFw==; 20:EiheDlBdFprNJIsY0QIbt380GVvIgtYW0Bs4Vwxs4taXbzhJaWFrhlHQJr2E78wYRxZkbqeGHQDdiiiP5FmbYfbKMV/8WYeOPhyt9xecXi0v8m0EgylrIOQF06/BgRkCVciPbiizsjfxT++mXubvr09GaIwK9HhxQOZj3z3C+WwJuIprRQ2GgkC89ygUkJVUV1ilEpmPB5eKTj80w5DZzsvUYfMvSz28/LVdSGVlfEjlZ+iUVGIuKT7c8aIOesgG+PLoMXkC19uT7i9039eSVmAnQYq6twikq6c6l1cmTC4E2CSqncdOI4BNJl/13U4pN7unstk/iCQXtoVT7S2u5pCuXmPZ8BCHaiA81Crl9nu9S4HJljGL3nk2IngJQih8AX5XFHzVnMPwoD7BwcNiLpmoTthuI0pVEEZblzrVctdJ3gDMbCHZeLy9D3UsyIL+2O3Mfp/qb0v6yjdSfpI74bSDEhcmolZFombDHKAOnNdmnCOf4jl1Gx9QLF7wVX1S X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:DB6PR0401MB2326; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0401MB2326; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0401MB2326; 4:86n0109AiWRvKcwKQSd9NljV4e72SVbfh1Xw7idmRoSx8eJu2yMpTRZTdf38ljuHwo4N4bmnK7Iq0mPjdGUxPGUWWxCIG/4QvC+PT7D3BvUCOzMKSpEPNpQ2g/py1xnMShJwL9d85r4WuX95cdZO2eh/jVMZzKAB/hsTKgNfbZsdgVdCTLX2g9Ni29/P6IxDEMCqnVVb09ZKBZvMFctmfSlBdBojLUC1liJawdiMSy4851A02eDe+4thv8f8xgeH5ICnyzoDMvupYUTAmIcyrkIZbAjvQkeFOWgjuUMoPz79HyDZejpukBCFg2TAhH5/8Oc1YP1sCYy5mRD7A9an1PzZ1hzkCc49vM0E9pDrV4EE42q2t6HNe+FzkLzKrWF4JsO2kY/dKNdz4fn+ymgleKAk87tpuhTVVdQbR7PjC3NYAiWKkezBeEkhNyCzEG//rNrwcTt9gLxbDpewd9UhzKaFpcUFlDtzj6b2cCMWgQOpIZeHM7VOD9SROnw+f55T X-Forefront-PRVS: 0098BA6C6C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(50986999)(47776003)(105586002)(33646002)(66066001)(77096005)(48376002)(106356001)(36756003)(50466002)(5001770100001)(19580395003)(8676002)(81166006)(81156014)(6116002)(5660300001)(3846002)(97736004)(4326007)(68736007)(7736002)(50226002)(42186005)(7846002)(86362001)(19580405001)(586003)(92566002)(229853001)(101416001)(6666003)(2906002)(5003940100001)(189998001)(305945005)(7099028)(223183001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0401MB2326; H:b51421-server.ap.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0401MB2326; 23:Ai11BMA6pVBUdytAMKDDXS9NQw/Z1s0/m3p82/V?= =?us-ascii?Q?jeDsoXPH0zN976VJSPProa2Qo4cJvhSyuwzFFTP67qS8rnG2SuCjkiXHyZ62?= =?us-ascii?Q?siHH/YQ7Dd4NafMqjZiwAMNk74qbNePMyd9JgsazozlCfiAugoDnjyOPQHMs?= =?us-ascii?Q?584H83mIE+hIELitOslHibB0O4NW0h/Z6CPaTUNHb4+adTJr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bG5oRUE1ZAFSEYogWHwUigaLy47ZFZCaJnhCmyCrNO7n5lm0wvSPzzpi2GzbGA4w= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2016 08:13:23.7324 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2326 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Potentially overflowing expression 1000000 * data->timeout_clks with type unsigned int is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type unsigned long long. To avoid overflow, cast 1000000U to type unsigned long long. Special thanks to Coverity. Fixes: 7f05538af71c ("mmc: sdhci: fix data timeout (part 2)") Signed-off-by: Haibo Chen Cc: stable@vger.kernel.org # v3.15+ --- drivers/mmc/host/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 223a91e..71654b9 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -687,7 +687,7 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd) * host->clock is in Hz. target_timeout is in us. * Hence, us = 1000000 * cycles / Hz. Round up. */ - val = 1000000 * data->timeout_clks; + val = 1000000ULL * data->timeout_clks; if (do_div(val, host->clock)) target_timeout++; target_timeout += val;