public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] fix uninitialized value
Date: Mon, 30 May 2022 10:00:16 +0200	[thread overview]
Message-ID: <20220530080016.602838-1-f.gruenbichler@proxmox.com> (raw)

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





             reply	other threads:[~2022-05-30  8:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-30  8:00 Fabian Grünbichler [this message]
2022-05-30 10:12 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220530080016.602838-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal