From patchwork Tue Feb 13 16:59:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 873022 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zgq6Z6qtNz9s7h for ; Wed, 14 Feb 2018 04:20:06 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965057AbeBMRUF (ORCPT ); Tue, 13 Feb 2018 12:20:05 -0500 Received: from gateway34.websitewelcome.com ([192.185.148.194]:47956 "EHLO gateway34.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934602AbeBMRUE (ORCPT ); Tue, 13 Feb 2018 12:20:04 -0500 X-Greylist: delayed 1213 seconds by postgrey-1.27 at vger.kernel.org; Tue, 13 Feb 2018 12:20:04 EST Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway34.websitewelcome.com (Postfix) with ESMTP id C17B57B1616 for ; Tue, 13 Feb 2018 10:59:50 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id ldvqe3CciuMnyldvqeijFE; 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-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: 14 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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) {