Blame SOURCES/libvirt-qemu-validate-Enforce-compile-time-switch-type-checking-for-videos.patch

982648
From 3bb028d79a9069ebc76bb27fa640af06adad2be5 Mon Sep 17 00:00:00 2001
982648
Message-Id: <3bb028d79a9069ebc76bb27fa640af06adad2be5@dist-git>
982648
From: Erik Skultety <eskultet@redhat.com>
982648
Date: Thu, 19 Jul 2018 15:03:53 +0200
982648
Subject: [PATCH] qemu: validate: Enforce compile time switch type checking for
982648
 videos
982648
MIME-Version: 1.0
982648
Content-Type: text/plain; charset=UTF-8
982648
Content-Transfer-Encoding: 8bit
982648
982648
There wasn't an explicit type case to the video type enum in
982648
qemuDomainDeviceDefValidateVideo, _TYPE_GOP was also missing from the
982648
switch.
982648
982648
Signed-off-by: Erik Skultety <eskultet@redhat.com>
982648
Reviewed-by: John Ferlan <jferlan@redhat.com>
982648
(cherry picked from commit 767f9e1449b1a36111532847f0c62dc758263c42)
982648
982648
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
982648
Signed-off-by: Erik Skultety <eskultet@redhat.com>
982648
Reviewed-by: Ján Tomko <jtomko@redhat.com>
982648
---
982648
 src/conf/domain_conf.h | 2 +-
982648
 src/qemu/qemu_domain.c | 3 ++-
982648
 2 files changed, 3 insertions(+), 2 deletions(-)
982648
982648
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
982648
index 1fc1734bcc..0f10e242fd 100644
982648
--- a/src/conf/domain_conf.h
982648
+++ b/src/conf/domain_conf.h
982648
@@ -1453,7 +1453,7 @@ struct _virDomainVideoDriverDef {
982648
 };
982648
 
982648
 struct _virDomainVideoDef {
982648
-    int type;
982648
+    int type;   /* enum virDomainVideoType */
982648
     unsigned int ram;  /* kibibytes (multiples of 1024) */
982648
     unsigned int vram; /* kibibytes (multiples of 1024) */
982648
     unsigned int vram64; /* kibibytes (multiples of 1024) */
982648
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
982648
index dec057e021..a42a6df91b 100644
982648
--- a/src/qemu/qemu_domain.c
982648
+++ b/src/qemu/qemu_domain.c
982648
@@ -4470,10 +4470,11 @@ qemuDomainDeviceDefValidateHostdev(const virDomainHostdevDef *hostdev,
982648
 static int
982648
 qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
982648
 {
982648
-    switch (video->type) {
982648
+    switch ((virDomainVideoType) video->type) {
982648
     case VIR_DOMAIN_VIDEO_TYPE_XEN:
982648
     case VIR_DOMAIN_VIDEO_TYPE_VBOX:
982648
     case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
982648
+    case VIR_DOMAIN_VIDEO_TYPE_GOP:
982648
     case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
982648
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
982648
                        _("video type '%s' is not supported with QEMU"),
982648
-- 
982648
2.18.0
982648