PCI: Fix overflow in command-line resource alignment requests
authorColin Ian King <colin.king@canonical.com>
Sat, 14 Nov 2020 21:48:04 +0000 (15:48 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:53:26 +0000 (11:53 +0100)
commit2df49a5de565ba5ed1c492e83e01b7d5d7c3a35d
tree81fa3d243def76bba1fcd992c1adaeaa39b20f12
parent3ce25814038050fa21b81d6ec55d1d4d59175b1a
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: 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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/pci.c