]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: validate: Enforce compile time switch type checking for videos
authorErik Skultety <eskultet@redhat.com>
Thu, 28 Jun 2018 08:55:47 +0000 (10:55 +0200)
committerErik Skultety <eskultet@redhat.com>
Mon, 9 Jul 2018 16:59:24 +0000 (18:59 +0200)
There wasn't an explicit type case to the video type enum in
qemuDomainDeviceDefValidateVideo, _TYPE_GOP was also missing from the
switch.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/conf/domain_conf.h
src/qemu/qemu_domain.c

index 1fc1734bcc8becf3c7bd8047d2c5a1a1414c56b3..0f10e242fda8f05e36460f0aa0b8ddf76ee8fa50 100644 (file)
@@ -1453,7 +1453,7 @@ struct _virDomainVideoDriverDef {
 };
 
 struct _virDomainVideoDef {
-    int type;
+    int type;   /* enum virDomainVideoType */
     unsigned int ram;  /* kibibytes (multiples of 1024) */
     unsigned int vram; /* kibibytes (multiples of 1024) */
     unsigned int vram64; /* kibibytes (multiples of 1024) */
index b10bbc40a4e1be3c429ceee5c3124fce9eef8132..964fe9796374012421363813e3b56043ccfbce97 100644 (file)
@@ -4470,10 +4470,11 @@ qemuDomainDeviceDefValidateHostdev(const virDomainHostdevDef *hostdev,
 static int
 qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
 {
-    switch (video->type) {
+    switch ((virDomainVideoType) video->type) {
     case VIR_DOMAIN_VIDEO_TYPE_XEN:
     case VIR_DOMAIN_VIDEO_TYPE_VBOX:
     case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
+    case VIR_DOMAIN_VIDEO_TYPE_GOP:
     case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("video type '%s' is not supported with QEMU"),