Received: by 10.223.185.116 with SMTP id b49csp3875871wrg; Tue, 13 Feb 2018 09:03:41 -0800 (PST) X-Google-Smtp-Source: AH8x225xy4Ad8wrKWeLS8WL4gmqgY/Dr08vPgIKxIO/AURxHwlbqCac2rTbH+6yblD1iAkgVQIJZ X-Received: by 2002:a17:902:24c7:: with SMTP id l7-v6mr1726658plg.268.1518541421396; Tue, 13 Feb 2018 09:03:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518541421; cv=none; d=google.com; s=arc-20160816; b=FRYsWABwhmVszw7+Fo4uqM2/AEozjVoOTbSLRpDSHnvaLYjdP9NfbQC7j54UICcb0n OPDY/07kzltFK9maJnABJr71lEMtxjzTlKpA2ROydi4prs3OEb/BNVV52/NJmh/I1pGL Ldu1uu4WElmxngU9cc+hBHKUOG8ZiDFN+Av/cT6oKSRkqUBWn96SUFeBX1Kkv7eyCVdN qLsQRUHbE/Mv+9JbYSur6I1QnuAnjoceUwN+wN852IHSO3bfHaP0ll7aOd9RJjPN/Pqz IbPjsOx2bp+BQUg69kuVf9An+V9paVHKJghel1pffb8YagtQf4K9RKA5GqbntuN7/gck 0+uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=kR/7McGArDlAEyH87x+23gOMEzmoxUyNMWlnSKUn7g0=; b=iiOBOrfl0Hqlbppha19Hna/19JW3SGl/kOdo8OYjJyPZT5cf2yjZ+9cJmsyYrgPdDy C6OjWmfVyvhfp5kMBHAFftDIUSHIZzhNvKgPQw/dihFA+1bACsyWq2ZQ26eMTLp1TUN/ PW0l9HbkWPMCg/ZonGzlREMtQoLYwcO9hHz3X5LuhqDKLPAsTrJat7j4qWjr/jrw9taR 4rP9sIBQxsLMs3ALQWDDE+w1LcBmOVozlZjZJ1e26tGb/1UbooM6uUTsi2O2+zq7Ixju JeIaii2zGnZjuMfoe2pSHNupf3shCdAoQCmFZjyRf4Lix22FRdsiYcUhLwjnnLJCQ8AN uDQw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9-v6si5697704plk.311.2018.02.13.09.03.02; Tue, 13 Feb 2018 09:03:41 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965292AbeBMQ7x (ORCPT + 99 others); Tue, 13 Feb 2018 11:59:53 -0500 Received: from gateway31.websitewelcome.com ([192.185.143.4]:14408 "EHLO gateway31.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964794AbeBMQ7v (ORCPT ); Tue, 13 Feb 2018 11:59:51 -0500 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway31.websitewelcome.com (Postfix) with ESMTP id A46FC1B160 for ; Tue, 13 Feb 2018 10:59:50 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id ldvqe3CchuMnyldvqeijFF; Tue, 13 Feb 2018 10:59:50 -0600 Received: from [189.175.4.238] (port=35086 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1eldvq-001IoH-B2; Tue, 13 Feb 2018 10:59:50 -0600 Date: Tue, 13 Feb 2018 10:59:49 -0600 From: "Gustavo A. R. Silva" To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] PCI/ASPM: Use 64-bit arithmetic instead of 32-bit Message-ID: <20180213165948.GA14035@embeddedor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.175.4.238 X-Source-L: No X-Exim-ID: 1eldvq-001IoH-B2 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.175.4.238]:35086 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 15 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add suffix ULL to constant 1000 in order to give the compiler complete information about the proper arithmetic to use. Notice that this constant is used in a context that expects an expression of type u64 (64 bits, unsigned). The expression threshold_us * 1000 is currently being evaluated using 32-bit arithmetic. Addresses-Coverity-ID: 1462501 Signed-off-by: Gustavo A. R. Silva --- drivers/pci/pcie/aspm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 57feef2..684d326 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -322,7 +322,7 @@ static u32 calc_l1ss_pwron(struct pci_dev *pdev, u32 scale, u32 val) static void encode_l12_threshold(u32 threshold_us, u32 *scale, u32 *value) { - u64 threshold_ns = threshold_us * 1000; + u64 threshold_ns = threshold_us * 1000ULL; /* See PCIe r3.1, sec 7.33.3 and sec 6.18 */ if (threshold_ns < 32) { -- 2.7.4