Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9817c8c authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman
Browse files

PCI: Fix overflow in command-line resource alignment requests



[ 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: 32a9a682 ("PCI: allow assignment of memory resources with a specified alignment")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6d7483c6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5854,7 +5854,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",