]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/qemu-xen-traditional.git/commitdiff
passthrough: fix off-by-one in PCI config space register index check
authorJan Beulich <jbeulich@suse.com>
Fri, 29 Jun 2012 16:06:25 +0000 (17:06 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Fri, 29 Jun 2012 16:06:25 +0000 (17:06 +0100)
Register 255 (0xff) is still valid to be accessed.

Reported-by: Rolu <rolu@roce.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
hw/pass-through.c

index 8581253bc86391d6e348e02464f9ed5d2e579a0d..6e396e37f0eeb04760a9cd98be93f2b6f3b09774 100644 (file)
@@ -1538,7 +1538,7 @@ static void pt_pci_write_config(PCIDevice *d, uint32_t address, uint32_t val,
 #endif
 
     /* check offset range */
-    if (address >= 0xFF)
+    if (address > 0xFF)
     {
         PT_LOG_DEV(d, "Error: Failed to write register with offset exceeding FFh. "
             "[Offset:%02xh][Length:%d]\n", address, len);
@@ -1714,7 +1714,7 @@ static uint32_t pt_pci_read_config(PCIDevice *d, uint32_t address, int len)
     int ret = 0;
 
     /* check offset range */
-    if (address >= 0xFF)
+    if (address > 0xFF)
     {
         PT_LOG_DEV(d, "Error: Failed to read register with offset exceeding FFh. "
             "[Offset:%02xh][Length:%d]\n", address, len);