summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2020-11-14 15:48:04 -0600
committerBjorn Helgaas <bhelgaas@google.com>2020-11-30 11:39:11 -0600
commitcc73eb321d246776e5a9f7723d15708809aa3699 (patch)
treeb3073688998856c382da8841406b7be5820445d2 /drivers/pci/pci.c
parent6534aac198b58309ff2337981d3f893e0be1d19d (diff)
PCI: Fix overflow in command-line resource alignment requests
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 <colin.king@canonical.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 711268776371..dd4bbb699abd 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",