Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9116848pxu; Mon, 28 Dec 2020 07:04:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxU+C9uDuIpMOBHiF6Xix38Ng36ndpDixmFMjsrxl6q28ZFwk43aK3ACFrEK+/AfmyKqhsw X-Received: by 2002:a17:906:f905:: with SMTP id lc5mr41772349ejb.177.1609167865976; Mon, 28 Dec 2020 07:04:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609167865; cv=none; d=google.com; s=arc-20160816; b=DRK6sAwxAscNwRe11P4Vyums05K/PgBs60TESwRm/KYVjvFSuhVDPMNW3y5FJZqFwC 0wsSk2r/Gez460N/2YI2PVEifvjtmyUDuuVoLL6hMI9qF+jC5gJSvkFKjEPPToT/tztW C3sAoBu7UGQI1MPo7SYl4E67E86Yy/kuU5DBz++8zATyt38L6vwBC5K8Ldm+ytqHxIQ5 997mngV2dYhXmv4LJKvQ7Xboc7qeH6XtLGEiDcVdDIRGmdZgToxXR2dCFWdEQ418oQ0g NbNKPuPjl3xKsBI3h1MmRRbPtT0ldgaXyXsQIzZz0t5bsTLX1h53Zxr8qgElGCyijZ4X Lmcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HyjeHPDqgzfpl5TFuqJlB3DR//GZ4t1ziDROrt90h4c=; b=m0cS6ibx7u5dFkejU4pPMBRml/Lgy+tLPDtdThv+E2EvG3V42WzMOByoy9aU8QcYTM oVa9mmxjZj0N8xP0E9bxxji0m8rj/I/uYz8KDOoSyqjcjt6ujYm6+jLpFdvxXDomAoGN B9pSWWHGiqxoBd1Z4+0ocymYg947PrwjBtSwbl/zy5LNS/A9M6IkWfXBmLKhwrTN+ARG SWP77LUriqbR97psgVt7fxMNRUm1GyvaeAGzhtJo51dgmsbZrSz/q2xydwcFSep45i6r JY/uuYW4AX4vtY48p0c0A6BYQl10HhaPoOQPWzUBdIPeQaiR7NzLJs/hWEsRGzzW/eye YQwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="b6/VcQt4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si18911195ejd.332.2020.12.28.07.04.03; Mon, 28 Dec 2020 07:04:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="b6/VcQt4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439995AbgL1OMx (ORCPT + 99 others); Mon, 28 Dec 2020 09:12:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:46706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439910AbgL1OMj (ORCPT ); Mon, 28 Dec 2020 09:12:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 556E52063A; Mon, 28 Dec 2020 14:12:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164743; bh=u81EBZxBV+ddhWB2v3XDMRlaNyq29QoFNxu9fFsZkf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b6/VcQt4S7LGv/TK61nIdhKB0NQKh+JTX1IrsZhirVm14BV5SCOHLsJYyPU3CSV07 kX0p/0Y9Sd+SNn9L23t/Zg5/aKwZIdy085c4yx7wI9HfreiWz+jW+CNYN+RH9R8nXD ncdRp050/ZmZz2Jh5Bh9GJ+IV4DbyrnNwv3Qmvvw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Bjorn Helgaas , Logan Gunthorpe , Sasha Levin Subject: [PATCH 5.10 241/717] PCI: Fix overflow in command-line resource alignment requests Date: Mon, 28 Dec 2020 13:43:59 +0100 Message-Id: <20201228125032.535801761@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King [ Upstream commit cc73eb321d246776e5a9f7723d15708809aa3699 ] The shift of 1 by align_order is evaluated using 32 bit arithmetic and the result is assigned to a resource_size_t type variable that is a 64 bit unsigned integer on 64 bit platforms. Fix an overflow before widening issue by making the 1 a ULL. Addresses-Coverity: ("Unintentional integer overflow") Fixes: 32a9a682bef2 ("PCI: allow assignment of memory resources with a specified alignment") Signed-off-by: Colin Ian King Signed-off-by: Bjorn Helgaas Reviewed-by: Logan Gunthorpe Signed-off-by: Sasha Levin --- drivers/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index b7a860e790979..6427cbd0a5be2 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -6216,7 +6216,7 @@ static resource_size_t pci_specified_resource_alignment(struct pci_dev *dev, ret = pci_dev_str_match(dev, p, &p); if (ret == 1) { *resize = true; - align = 1 << align_order; + align = 1ULL << align_order; break; } else if (ret < 0) { pr_err("PCI: Can't parse resource_alignment parameter: %s\n", -- 2.27.0