Blame 0430-ui-spice-display-use-uintptr_t-when-casting-qxl-phys.patch

Hans de Goede 56753f
From 626eb7b96445815945600895a411ee14c10b9056 Mon Sep 17 00:00:00 2001
Hans de Goede 56753f
From: Alon Levy <alevy@redhat.com>
Hans de Goede 56753f
Date: Wed, 21 Mar 2012 18:17:18 +0200
Hans de Goede 56753f
Subject: [PATCH 430/434] ui/spice-display: use uintptr_t when casting qxl
Hans de Goede 56753f
 physical addresses
Hans de Goede 56753f
Hans de Goede 56753f
The current intptr_t casts are a problem when the address's highest
Hans de Goede 56753f
bit is 1, and it is cast to a intptr_t and then to uint64_t, such
Hans de Goede 56753f
as at:
Hans de Goede 56753f
     surface.mem        = (intptr_t)ssd->buf;
Hans de Goede 56753f
Hans de Goede 56753f
This causes the sign bit to be extended which causes a wrong address to
Hans de Goede 56753f
be passed on to spice, which then complains when it gets the wrong
Hans de Goede 56753f
slot_id number, since the slot_id is taken from the higher bits.
Hans de Goede 56753f
Hans de Goede 56753f
The assertion happens early - during the first primary surface creation.
Hans de Goede 56753f
Hans de Goede 56753f
This fixes running "-vga qxl -spice" with 32 bit compiled
Hans de Goede 56753f
qemu-system-i386.
Hans de Goede 56753f
Hans de Goede 56753f
Signed-off-by: Alon Levy <alevy@redhat.com>
Hans de Goede 56753f
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Hans de Goede 56753f
---
Hans de Goede 56753f
 ui/spice-display.c |   10 +++++-----
Hans de Goede 56753f
 1 file changed, 5 insertions(+), 5 deletions(-)
Hans de Goede 56753f
Hans de Goede 56753f
diff --git a/ui/spice-display.c b/ui/spice-display.c
Hans de Goede 56753f
index 6d7563f..cb8a7ad 100644
Hans de Goede 56753f
--- a/ui/spice-display.c
Hans de Goede 56753f
+++ b/ui/spice-display.c
Hans de Goede 56753f
@@ -168,7 +168,7 @@ static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
Hans de Goede 56753f
     drawable->bbox            = ssd->dirty;
Hans de Goede 56753f
     drawable->clip.type       = SPICE_CLIP_TYPE_NONE;
Hans de Goede 56753f
     drawable->effect          = QXL_EFFECT_OPAQUE;
Hans de Goede 56753f
-    drawable->release_info.id = (intptr_t)update;
Hans de Goede 56753f
+    drawable->release_info.id = (uintptr_t)update;
Hans de Goede 56753f
     drawable->type            = QXL_DRAW_COPY;
Hans de Goede 56753f
     drawable->surfaces_dest[0] = -1;
Hans de Goede 56753f
     drawable->surfaces_dest[1] = -1;
Hans de Goede 56753f
@@ -179,7 +179,7 @@ static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
Hans de Goede 56753f
                       + time_space.tv_nsec / 1000 / 1000;
Hans de Goede 56753f
 
Hans de Goede 56753f
     drawable->u.copy.rop_descriptor  = SPICE_ROPD_OP_PUT;
Hans de Goede 56753f
-    drawable->u.copy.src_bitmap      = (intptr_t)image;
Hans de Goede 56753f
+    drawable->u.copy.src_bitmap      = (uintptr_t)image;
Hans de Goede 56753f
     drawable->u.copy.src_area.right  = bw;
Hans de Goede 56753f
     drawable->u.copy.src_area.bottom = bh;
Hans de Goede 56753f
 
Hans de Goede 56753f
@@ -189,7 +189,7 @@ static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
Hans de Goede 56753f
     image->bitmap.stride     = bw * 4;
Hans de Goede 56753f
     image->descriptor.width  = image->bitmap.x = bw;
Hans de Goede 56753f
     image->descriptor.height = image->bitmap.y = bh;
Hans de Goede 56753f
-    image->bitmap.data = (intptr_t)(update->bitmap);
Hans de Goede 56753f
+    image->bitmap.data = (uintptr_t)(update->bitmap);
Hans de Goede 56753f
     image->bitmap.palette = 0;
Hans de Goede 56753f
     image->bitmap.format = SPICE_BITMAP_FMT_32BIT;
Hans de Goede 56753f
 
Hans de Goede 56753f
@@ -210,7 +210,7 @@ static SimpleSpiceUpdate *qemu_spice_create_update(SimpleSpiceDisplay *ssd)
Hans de Goede 56753f
     }
Hans de Goede 56753f
 
Hans de Goede 56753f
     cmd->type = QXL_CMD_DRAW;
Hans de Goede 56753f
-    cmd->data = (intptr_t)drawable;
Hans de Goede 56753f
+    cmd->data = (uintptr_t)drawable;
Hans de Goede 56753f
 
Hans de Goede 56753f
     memset(&ssd->dirty, 0, sizeof(ssd->dirty));
Hans de Goede 56753f
     return update;
Hans de Goede 56753f
@@ -254,7 +254,7 @@ void qemu_spice_create_host_primary(SimpleSpiceDisplay *ssd)
Hans de Goede 56753f
     surface.mouse_mode = true;
Hans de Goede 56753f
     surface.flags      = 0;
Hans de Goede 56753f
     surface.type       = 0;
Hans de Goede 56753f
-    surface.mem        = (intptr_t)ssd->buf;
Hans de Goede 56753f
+    surface.mem        = (uintptr_t)ssd->buf;
Hans de Goede 56753f
     surface.group_id   = MEMSLOT_GROUP_HOST;
Hans de Goede 56753f
 
Hans de Goede 56753f
     qemu_spice_create_primary_surface(ssd, 0, &surface, QXL_SYNC);
Hans de Goede 56753f
-- 
Hans de Goede 56753f
1.7.10
Hans de Goede 56753f