* [pve-devel] [PATCH qemu-server] fix #4435: devices list: avoid error for undefined value
@ 2023-01-10 13:41 Fiona Ebner
2023-01-11 9:15 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2023-01-10 13:41 UTC (permalink / raw)
To: pve-devel
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>
---
PVE/QemuServer.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 39fc6b09..4292da74 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -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}};
--
2.30.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH qemu-server] fix #4435: devices list: avoid error for undefined value
2023-01-10 13:41 [pve-devel] [PATCH qemu-server] fix #4435: devices list: avoid error for undefined value Fiona Ebner
@ 2023-01-11 9:15 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2023-01-11 9:15 UTC (permalink / raw)
To: Proxmox VE development discussion, Fiona Ebner
Am 10/01/2023 um 14:41 schrieb Fiona Ebner:
> 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>
> ---
> PVE/QemuServer.pm | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-11 9:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 13:41 [pve-devel] [PATCH qemu-server] fix #4435: devices list: avoid error for undefined value Fiona Ebner
2023-01-11 9:15 ` [pve-devel] applied: " Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal