Patchwork [1/2] qxl: disallow unknown revisions

login
register
mail settings
Submitter Alon Levy
Date July 23, 2012, 1:08 p.m.
Message ID <1343048893-2222-1-git-send-email-alevy@redhat.com>
Download mbox | patch
Permalink /patch/172674/
State New
Headers show

Comments

Alon Levy - July 23, 2012, 1:08 p.m.
Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/qxl.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/hw/qxl.c b/hw/qxl.c
index c2dd3b4..3a883ce 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1785,10 +1785,13 @@  static int qxl_init_common(PCIQXLDevice *qxl)
         io_size = 16;
         break;
     case 3: /* qxl-3 */
-    default:
         pci_device_rev = QXL_DEFAULT_REVISION;
         io_size = msb_mask(QXL_IO_RANGE_SIZE * 2 - 1);
         break;
+    default:
+        error_report("Invalid revision %d for qxl device (max %d)",
+                     qxl->revision, QXL_DEFAULT_REVISION);
+        return -1;
     }
 
     pci_set_byte(&config[PCI_REVISION_ID], pci_device_rev);