mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-03 09:30:05 +00:00
fix #4435: devices list: avoid error for undefined value
When $d->{'pci_bridge'}->{devices} is undef, @-dereferencing it will
die with:
> Can't use an undefined value as an ARRAY reference
This can happen (at least) when the VM is in 'prelaunch' state. The
QAPI definition for '@PciBridgeInfo' also declares the 'devices'
member as optional.
Before commit 721624b ("collect device list for nested pci-bridges"),
there was no issue, because $d->{'pci_bridge'}->{devices} was used in
foreach, so auto-vivified if undef.
Fixes: f721624b
("collect device list for nested pci-bridges")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
62b26624c6
commit
b3a3e92962
@ -4194,7 +4194,7 @@ sub vm_devices_list {
|
||||
my $to_check = [];
|
||||
for my $d (@$devices_to_check) {
|
||||
$devices->{$d->{'qdev_id'}} = 1 if $d->{'qdev_id'};
|
||||
next if !$d->{'pci_bridge'};
|
||||
next if !$d->{'pci_bridge'} || !$d->{'pci_bridge'}->{devices};
|
||||
|
||||
$devices->{$d->{'qdev_id'}} += scalar(@{$d->{'pci_bridge'}->{devices}});
|
||||
push @$to_check, @{$d->{'pci_bridge'}->{devices}};
|
||||
|
Loading…
Reference in New Issue
Block a user