[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 3/9] hw/usb-net.c: fix state check



From: "Luis R. Rodriguez" <mcgrof@xxxxxxxx>

The existing check is incorrect, currently it will actually allow
the code path to move on regardless of the state, fix this.

This is fixed upstream on qemu by the following commit:

commit 98d23704138e0be17a3ed9eb2631077bf92cc028
Author: Peter Maydell <peter.maydell@xxxxxxxxxx>
Date:   Wed Nov 9 21:09:23 2011 +0000

    hw/usb-net.c: Fix precedence bug when checking rndis_state

    "!X == 2" is always false (spotted by Coverity), so the checks
    for whether rndis is in the correct state would never fire.

    Signed-off-by: Peter Maydell <peter.maydell@xxxxxxxxxx>
    Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>

Cc: Peter Maydell <peter.maydell@xxxxxxxxxx>
Cc: Anthony Liguori <aliguori@xxxxxxxxxx>
Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxx>
---
 hw/usb-net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/usb-net.c b/hw/usb-net.c
index 863c25fd9cb9..b4b0f9409c2f 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1376,7 +1376,7 @@ static void usbnet_receive(void *opaque, const uint8_t 
*buf, int size)
 
     if (s->rndis) {
         msg = (struct rndis_packet_msg_type *) s->in_buf;
-        if (!s->rndis_state == RNDIS_DATA_INITIALIZED)
+        if (s->rndis_state != RNDIS_DATA_INITIALIZED)
             return;
         if (size + sizeof(struct rndis_packet_msg_type) > sizeof(s->in_buf))
             return;
@@ -1409,7 +1409,7 @@ static int usbnet_can_receive(void *opaque)
 {
     USBNetState *s = opaque;
 
-    if (s->rndis && !s->rndis_state == RNDIS_DATA_INITIALIZED)
+    if (s->rndis && s->rndis_state != RNDIS_DATA_INITIALIZED)
         return 1;
 
     return !s->in_len;
-- 
2.6.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.