peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0034-Revert-spice-vmc-two-bugfixes-in-vmc_read.patch

Justin M. Forbes a81953
From 84115ef1adf343c34eebfb1045cbc5c72892e3b2 Mon Sep 17 00:00:00 2001
Justin M. Forbes a81953
From: Gerd Hoffmann <kraxel@redhat.com>
Justin M. Forbes a81953
Date: Wed, 8 Sep 2010 11:46:18 +0200
Justin M. Forbes a81953
Subject: [PATCH 34/39] Revert "spice-vmc: two bugfixes in vmc_read"
Justin M. Forbes a81953
Justin M. Forbes a81953
This reverts commit 71983a37e30c68beab5e9056a4600d2958f77a04.
Justin M. Forbes a81953
---
Justin M. Forbes a81953
 hw/spice-vmc.c |   13 +++++--------
Justin M. Forbes a81953
 1 files changed, 5 insertions(+), 8 deletions(-)
Justin M. Forbes a81953
Justin M. Forbes a81953
diff --git a/hw/spice-vmc.c b/hw/spice-vmc.c
Justin M. Forbes a81953
index 06e30e6..3f6a2bb 100644
Justin M. Forbes a81953
--- a/hw/spice-vmc.c
Justin M. Forbes a81953
+++ b/hw/spice-vmc.c
Justin M. Forbes a81953
@@ -45,7 +45,7 @@ static int vmc_write(SpiceVDIPortInstance *sin, const uint8_t *buf, int len)
Justin M. Forbes a81953
     ssize_t out;
Justin M. Forbes a81953
Justin M. Forbes a81953
     out = virtio_serial_write(&svc->port, buf, len);
Justin M. Forbes a81953
-    dprintf(svc, 3, "%s: %lu/%d\n", __func__, out, len);
Justin M. Forbes a81953
+    dprintf(svc, 2, "%s: %lu/%d\n", __func__, out, len);
Justin M. Forbes a81953
     return out;
Justin M. Forbes a81953
 }
Justin M. Forbes a81953
Justin M. Forbes a81953
@@ -54,16 +54,13 @@ static int vmc_read(SpiceVDIPortInstance *sin, uint8_t *buf, int len)
Justin M. Forbes a81953
     SpiceVirtualChannel *svc = container_of(sin, SpiceVirtualChannel, sin);
Justin M. Forbes a81953
     int bytes = MIN(len, svc->datalen);
Justin M. Forbes a81953
Justin M. Forbes a81953
-    dprintf(svc, 2, "%s: %p %d/%d/%zd\n", __func__, svc->datapos, len, bytes, svc->datalen);
Justin M. Forbes a81953
-    if (bytes > 0) {
Justin M. Forbes a81953
+    dprintf(svc, 2, "%s: %d/%zd\n", __func__, bytes, svc->datalen);
Justin M. Forbes a81953
+    if (bytes) {
Justin M. Forbes a81953
         memcpy(buf, svc->datapos, bytes);
Justin M. Forbes a81953
         svc->datapos += bytes;
Justin M. Forbes a81953
         svc->datalen -= bytes;
Justin M. Forbes a81953
-        assert(svc->datalen >= 0);
Justin M. Forbes a81953
-        if (svc->datalen == 0) {
Justin M. Forbes a81953
-            svc->datapos = 0;
Justin M. Forbes a81953
+        if (0 == svc->datalen) {
Justin M. Forbes a81953
             virtio_serial_throttle_port(&svc->port, false);
Justin M. Forbes a81953
-            // ^^^ !!! may call vmc_have_data, so don't touch svc after it!
Justin M. Forbes a81953
         }
Justin M. Forbes a81953
     }
Justin M. Forbes a81953
     return bytes;
Justin M. Forbes a81953
@@ -143,7 +140,7 @@ static void vmc_have_data(VirtIOSerialPort *port, const uint8_t *buf, size_t len
Justin M. Forbes a81953
     SpiceVirtualChannel *svc = DO_UPCAST(SpiceVirtualChannel, port, port);
Justin M. Forbes a81953
Justin M. Forbes a81953
     dprintf(svc, 2, "%s: %zd\n", __func__, len);
Justin M. Forbes a81953
-    assert(svc->datalen == 0);
Justin M. Forbes a81953
+    assert(svc->datapos == 0);
Justin M. Forbes a81953
     if (svc->bufsize < len) {
Justin M. Forbes a81953
         svc->bufsize = len;
Justin M. Forbes a81953
         svc->buffer = qemu_realloc(svc->buffer, svc->bufsize);
Justin M. Forbes a81953
-- 
Justin M. Forbes a81953
1.7.2.3
Justin M. Forbes a81953