mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
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>
This commit is contained in:
parent
0d30b0a2d3
commit
09f1bbcd83
4 changed files with 7 additions and 10 deletions
2
hw/pci.h
2
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];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue