]> git.karo-electronics.de Git - karo-tx-linux.git/commit
PCI: fix P2P bridge I/O port window sign extension
authorBjorn Helgaas <bhelgaas@google.com>
Tue, 19 Jun 2012 13:45:44 +0000 (07:45 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 20 Jun 2012 23:28:53 +0000 (17:28 -0600)
commit8f38eaca55d0fab7499b33adb1dec33e16de5abb
treed5f7a0b123d073b8fb75ca46e82e1862f88a9e13
parent8291550f8479fde2cee571d1b367e6918819f189
PCI: fix P2P bridge I/O port window sign extension

On P2P bridges with 32-bit I/O decoding, we incorrectly sign-extended
windows starting at 0x80000000 or above.  In "base |= (io_base_hi << 16)",
"io_base_hi" is promoted to a signed int before being extended to an
unsigned long.

This would cause a window starting at I/O address 0x80000000 to be
treated as though it started at 0xffffffff80008000 instead, which
should cause "no compatible bridge window" errors when we enumerate
devices using that I/O space.

The mmio and mmio_pref casts are not strictly necessary, but without
them, correctness depends on the types of the PCI_MEMORY_RANGE_MASK and
PCI_PREF_RANGE_MASK constants, which are not obvious from reading the
local code.

Found by Coverity (CID 138747 and CID 138748).

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/probe.c