[pve-devel] [PATCH qemu-server 3/7] USB: print_usbdevice_full: error out on invalid configuration

Dominik Csapak d.csapak at proxmox.com
Thu Nov 10 15:35:54 CET 2022


should not happen normally, but an inattentive user of that function
may forget to check the validity of the parsed device, so err
on the safe side here

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

diff --git a/PVE/QemuServer/USB.pm b/PVE/QemuServer/USB.pm
index 3c8da2c..b669c91 100644
--- a/PVE/QemuServer/USB.pm
+++ b/PVE/QemuServer/USB.pm
@@ -120,6 +120,8 @@ sub print_usbdevice_full {
 	$usbdevice .= ",vendorid=0x$device->{vendorid},productid=0x$device->{productid}";
     } elsif (defined($device->{hostbus}) && defined($device->{hostport})) {
 	$usbdevice .= ",hostbus=$device->{hostbus},hostport=$device->{hostport}";
+    } else {
+	die "no usb id or path given\n";
     }
 
     $usbdevice .= ",id=$deviceid";
-- 
2.30.2






More information about the pve-devel mailing list