[PATCH] PCI: NUMA-Q PCI config access arg validation

Greg KH
2005-03-04T21:47:56Z

ChangeSet 1.1998.11.12, 2005/02/07 16:20:50-08:00, bjorn.helgaas@hp.com

[PATCH] PCI: NUMA-Q PCI config access arg validation

Fix NUMA-Q PCI config access bus validation. "bus" indexes
into BUS2QUAD, which is mp_bus_id_to_node[MAX_MP_BUSSES].

This depends on the "pci_raw_ops should use unsigned args"
patch I posted earlier today (no functional dependency; it
just happens to be very close textually).

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Martin J. Bligh <mbligh@aracnet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

arch/i386/pci/numa.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff -Nru a/arch/i386/pci/numa.c b/arch/i386/pci/numa.c
--- a/arch/i386/pci/numa.c 2005-03-04 12:42:52 -08:00
+++ b/arch/i386/pci/numa.c 2005-03-04 12:42:52 -08:00
@@ -18,7 +18,7 @@
{
unsigned long flags;

- if (!value || (bus > MAX_MP_BUSSES) || (devfn > 255) || (reg > 255))
+ if (!value || (bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255))
return -EINVAL;

spin_lock_irqsave(&pci_config_lock, flags);
@@ -46,7 +46,7 @@
{
unsigned long flags;

- if ((bus > MAX_MP_BUSSES) || (devfn > 255) || (reg > 255))
+ if ((bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255))
return -EINVAL;

spin_lock_irqsave(&pci_config_lock, flags);