x86/PCI: Fix Broadcom CNB20LE unintended sign extension (redux)
authorColin Ian King <colin.king@canonical.com>
Thu, 25 Oct 2018 13:52:31 +0000 (14:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 18:46:58 +0000 (19:46 +0100)
commit534a0c21119bab4b5d7b2e7f331ab3fba2ebedfe
tree1f7ee65b1dbb57a6dea91059a96dedf8070935cc
parentee9268a9b55b82bcc77c64bf137eb9aa7cf87aa9
x86/PCI: Fix Broadcom CNB20LE unintended sign extension (redux)

[ Upstream commit 53bb565fc5439f2c8c57a786feea5946804aa3e9 ]

In the expression "word1 << 16", word1 starts as u16, but is promoted to a
signed int, then sign-extended to resource_size_t, which is probably not
what was intended.  Cast to resource_size_t to avoid the sign extension.

This fixes an identical issue as fixed by commit 0b2d70764bb3 ("x86/PCI:
Fix Broadcom CNB20LE unintended sign extension") back in 2014.

Detected by CoverityScan, CID#138749, 138750 ("Unintended sign extension")

Fixes: 3f6ea84a3035 ("PCI: read memory ranges out of Broadcom CNB20LE host bridge")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/pci/broadcom_bus.c