[pve-devel] [PATCH qemu-server] cfg2cmd: fix uninitialized value warning on OVMF w/o efidisk

Stefan Reiter s.reiter at proxmox.com
Wed May 6 14:17:52 CEST 2020


It's possible to have a VM with OVMF but without an efidisk, so don't
call parse_drive on a potential undef value.

Partial revert of 818c3b8d91 ("cfg2cmd: ovmf: code cleanup")

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
 PVE/QemuServer.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index e9b094b..e76aee3 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3084,7 +3084,8 @@ sub config_to_command {
 	die "uefi base image '$ovmf_code' not found\n" if ! -f $ovmf_code;
 
 	my ($path, $format);
-	if (my $d = parse_drive('efidisk0', $conf->{efidisk0})) {
+	if (my $efidisk = $conf->{efidisk0}) {
+	    my $d = parse_drive('efidisk0', $efidisk);
 	    my ($storeid, $volname) = PVE::Storage::parse_volume_id($d->{file}, 1);
 	    $format = $d->{format};
 	    if ($storeid) {
-- 
2.20.1





More information about the pve-devel mailing list