]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 30 Nov 2020 17:39:11 +0000 (11:39 -0600)
commit4e30e022e4d2356d72705c89e46f24735c1c1279
treeb3073688998856c382da8841406b7be5820445d2
parent74bac1f7b51f314506bc286aa509bf8890289146
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: 5c6b3ab9297a ("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>
drivers/pci/pci.c