summaryrefslogtreecommitdiffstats
path: root/hw/pci.h
diff options
context:
space:
mode:
authorMichael Roth2012-03-04 20:38:27 +0100
committerAndreas Färber2012-06-08 16:11:14 +0200
commit09f1bbcd834c63da35b3fe190fcd9a20d7b04f07 (patch)
tree49be20255dd293b1af972a1d7b8cd4cd6e9d87ae /hw/pci.h
parentqapi: Add String visitor coverage to serialization unit tests (diff)
downloadqemu-09f1bbcd834c63da35b3fe190fcd9a20d7b04f07.tar.gz
qemu-09f1bbcd834c63da35b3fe190fcd9a20d7b04f07.tar.xz
qemu-09f1bbcd834c63da35b3fe190fcd9a20d7b04f07.zip
qdev: Use int32_t container for devfn property
Valid range for devfn is -1 to 255 (-1 for automatic assignment). We do not currently validate this due to devfn being stored as a uint32_t. This can lead to segfaults and other strange behavior. We could technically just cast it to int32_t to implement the checking, but this will not work for visitor-based setting where we may do additional bounds-checking based on target container type, which is int32_t for this case. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/pci.h')
-rw-r--r--hw/pci.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/pci.h b/hw/pci.h
index c3cacce046..7f223c01e1 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -197,7 +197,7 @@ struct PCIDevice {
/* the following fields are read only */
PCIBus *bus;
- uint32_t devfn;
+ int32_t devfn;
char name[64];
PCIIORegion io_regions[PCI_NUM_REGIONS];