[pve-devel] [PATCH qemu-server] fix #2032: check that type is set before using

Dominik Csapak d.csapak at proxmox.com
Mon Dec 17 09:19:58 CET 2018


When not setting 'vga' we would get a warning:

Use of uninitialized value $type in string eq at
/usr/share/perl5/PVE/QemuServer.pm line 2026.

This patch changes the order of the conditions and checks if $type is set
before using it, so that we do not get the warning anymore.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/QemuServer.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 4a6a6cc..38b511e 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2023,7 +2023,7 @@ sub print_vga_device {
     my ($conf, $vga, $arch, $machine, $id, $qxlnum, $bridges) = @_;
 
     my $type = $vga_map->{$vga->{type}};
-    if ($type eq 'virtio-vga' && $arch eq 'aarch64') {
+    if ($arch eq 'aarch64' && defined($type) && $type eq 'virtio-vga') {
 	$type = 'virtio-gpu';
     }
     my $vgamem_mb = $vga->{memory};
-- 
2.11.0





More information about the pve-devel mailing list