qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [5242] [PATCH] usb-serial: Fix data corruption with usb serial emulation
@ 2008-09-17 22:04 Aurelien Jarno
  0 siblings, 0 replies; only message in thread
From: Aurelien Jarno @ 2008-09-17 22:04 UTC (permalink / raw)
  To: qemu-devel

Revision: 5242
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5242
Author:   aurel32
Date:     2008-09-17 22:04:21 +0000 (Wed, 17 Sep 2008)

Log Message:
-----------
[PATCH] usb-serial: Fix data corruption with usb serial emulation

* Remove the unused send_buf variable and its constant.

* Fix a math error
  The variables recv_ptr and recv_used are not large enough to hold
  the constant 384, which causes data corruption when the pointer is
  reset with: s->recv_ptr = (s->recv_ptr + len) % RECV_BUF;

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Modified Paths:
--------------
    trunk/hw/usb-serial.c

Modified: trunk/hw/usb-serial.c
===================================================================
--- trunk/hw/usb-serial.c	2008-09-17 19:05:19 UTC (rev 5241)
+++ trunk/hw/usb-serial.c	2008-09-17 22:04:21 UTC (rev 5242)
@@ -22,7 +22,6 @@
 #endif
 
 #define RECV_BUF 384
-#define SEND_BUF 128        // Not used for now
 
 /* Commands */
 #define FTDI_RESET		0
@@ -94,9 +93,8 @@
     uint16_t vendorid;
     uint16_t productid;
     uint8_t recv_buf[RECV_BUF];
-    uint8_t recv_ptr;
-    uint8_t recv_used;
-    uint8_t send_buf[SEND_BUF];
+    uint16_t recv_ptr;
+    uint16_t recv_used;
     uint8_t event_chr;
     uint8_t error_chr;
     uint8_t event_trigger;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-09-17 22:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-17 22:04 [Qemu-devel] [5242] [PATCH] usb-serial: Fix data corruption with usb serial emulation Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).