dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0226-qxl-update_area_io-cleanup-invalid-parameters-handli.patch

Hans de Goede 5ba1a7
From 286f37492e7e3f746aba6fb5df4579a7fc1301da Mon Sep 17 00:00:00 2001
Hans de Goede 5ba1a7
From: Michael Tokarev <mjt@tls.msk.ru>
Hans de Goede 5ba1a7
Date: Wed, 19 Sep 2012 17:41:26 +0400
Hans de Goede 5ba1a7
Subject: [PATCH 227/228] qxl/update_area_io: cleanup invalid parameters
Hans de Goede 5ba1a7
 handling
Hans de Goede 5ba1a7
Hans de Goede 5ba1a7
This cleans up two additions of almost the same code in commits
Hans de Goede 5ba1a7
511b13e2c9 and ccc2960d654.  While at it, make error paths
Hans de Goede 5ba1a7
consistent (always use 'break' instead of 'return').
Hans de Goede 5ba1a7
Hans de Goede 5ba1a7
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Hans de Goede 5ba1a7
Cc: Dunrong Huang <riegamaths@gmail.com>
Hans de Goede 5ba1a7
Cc: Alon Levy <alevy@redhat.com>
Hans de Goede 5ba1a7
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Hans de Goede 5ba1a7
---
Hans de Goede 5ba1a7
 hw/qxl.c | 13 +++----------
Hans de Goede 5ba1a7
 1 file changed, 3 insertions(+), 10 deletions(-)
Hans de Goede 5ba1a7
Hans de Goede 5ba1a7
diff --git a/hw/qxl.c b/hw/qxl.c
Hans de Goede 5ba1a7
index bb0b5e1..1f0f4e7 100644
Hans de Goede 5ba1a7
--- a/hw/qxl.c
Hans de Goede 5ba1a7
+++ b/hw/qxl.c
Hans de Goede 5ba1a7
@@ -1551,20 +1551,13 @@ async_common:
Hans de Goede 5ba1a7
         if (d->ram->update_surface > d->ssd.num_surfaces) {
Hans de Goede 5ba1a7
             qxl_set_guest_bug(d, "QXL_IO_UPDATE_AREA: invalid surface id %d\n",
Hans de Goede 5ba1a7
                               d->ram->update_surface);
Hans de Goede 5ba1a7
-            return;
Hans de Goede 5ba1a7
+            break;
Hans de Goede 5ba1a7
         }
Hans de Goede 5ba1a7
-        if (update.left >= update.right || update.top >= update.bottom) {
Hans de Goede 5ba1a7
+        if (update.left >= update.right || update.top >= update.bottom ||
Hans de Goede 5ba1a7
+            update.left < 0 || update.top < 0) {
Hans de Goede 5ba1a7
             qxl_set_guest_bug(d,
Hans de Goede 5ba1a7
                     "QXL_IO_UPDATE_AREA: invalid area (%ux%u)x(%ux%u)\n",
Hans de Goede 5ba1a7
                     update.left, update.top, update.right, update.bottom);
Hans de Goede 5ba1a7
-            return;
Hans de Goede 5ba1a7
-        }
Hans de Goede 5ba1a7
-
Hans de Goede 5ba1a7
-        if (update.left < 0 || update.top < 0 || update.left >= update.right ||
Hans de Goede 5ba1a7
-            update.top >= update.bottom) {
Hans de Goede 5ba1a7
-            qxl_set_guest_bug(d, "QXL_IO_UPDATE_AREA: "
Hans de Goede 5ba1a7
-                              "invalid area(%d,%d,%d,%d)\n", update.left,
Hans de Goede 5ba1a7
-                              update.right, update.top, update.bottom);
Hans de Goede 5ba1a7
             break;
Hans de Goede 5ba1a7
         }
Hans de Goede 5ba1a7
         if (async == QXL_ASYNC) {
Hans de Goede 5ba1a7
-- 
Hans de Goede 5ba1a7
1.7.12
Hans de Goede 5ba1a7