all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] fix uninitialized value
@ 2022-05-30  8:00 Fabian Grünbichler
  2022-05-30 10:12 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2022-05-30  8:00 UTC (permalink / raw)
  To: pve-devel

if the configured display hardware has the (optional) default type, but
some other attribute is set, this would match against `undef` and spew
lots of warnings in the logs.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
see https://forum.proxmox.com/threads/pvedaemon-use-of-uninitialized-value-in-pattern-match.110183/

 PVE/API2/Qemu.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index a8246574..99b426ec 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2443,8 +2443,9 @@ __PACKAGE__->register_method({
 
 	if ($conf->{vga}) {
 	    my $vga = PVE::QemuServer::parse_vga($conf->{vga});
-	    $status->{spice} = 1
-		if $vga->{type} =~ /^virtio/ || PVE::QemuServer::vga_conf_has_spice($conf->{vga});
+	    my $spice = defined($vga->{type}) && $vga->{type} =~ /^virtio/;
+	    $spice ||= PVE::QemuServer::vga_conf_has_spice($conf->{vga});
+	    $status->{spice} = 1 if $spice;
 	}
 	$status->{agent} = 1 if PVE::QemuServer::get_qga_key($conf, 'enabled');
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-30 10:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-30  8:00 [pve-devel] [PATCH qemu-server] fix uninitialized value Fabian Grünbichler
2022-05-30 10:12 ` [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