diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-17 22:04:21 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-09-17 22:04:21 +0000 |
commit | 8109b9b6bf934a39e73c90fb804e2d5af02391d1 (patch) | |
tree | f9c873330599c5ede5540ed21bd46436a234113a /hw | |
parent | 49237acdb725ef6d709aa8cb81fd1b13afa59064 (diff) | |
download | qemu-8109b9b6bf934a39e73c90fb804e2d5af02391d1.zip |
[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>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5242 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r-- | hw/usb-serial.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/hw/usb-serial.c b/hw/usb-serial.c index 92d6dfdd42..40d04cb2db 100644 --- a/hw/usb-serial.c +++ b/hw/usb-serial.c @@ -22,7 +22,6 @@ do { printf("usb-serial: " fmt , ##args); } while (0) #endif #define RECV_BUF 384 -#define SEND_BUF 128 // Not used for now /* Commands */ #define FTDI_RESET 0 @@ -94,9 +93,8 @@ typedef struct { 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; |