1
0
Fork 0

PCI: Fix overflow in command-line resource alignment requests

[ Upstream commit cc73eb321d ]

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: 32a9a682be ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5.4-rM2-2.2.x-imx-squashed
Colin Ian King 2020-11-14 15:48:04 -06:00 committed by Greg Kroah-Hartman
parent 048b98083c
commit 4ef5a46d29
1 changed files with 1 additions and 1 deletions

View File

@ -6143,7 +6143,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",