From 09f1bbcd834c63da35b3fe190fcd9a20d7b04f07 Mon Sep 17 00:00:00 2001 From: Michael Roth Date: Sun, 4 Mar 2012 13:38:27 -0600 Subject: qdev: Use int32_t container for devfn property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Paolo Bonzini Signed-off-by: Andreas Färber --- hw/pci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw/pci.h') 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]; -- cgit 1.4.1