]> Git Repo - qemu.git/commitdiff
hw/usb-net.c: Fix precedence bug when checking rndis_state
authorPeter Maydell <[email protected]>
Wed, 9 Nov 2011 21:09:23 +0000 (21:09 +0000)
committerAndrzej Zaborowski <[email protected]>
Mon, 14 Nov 2011 01:19:24 +0000 (02:19 +0100)
"!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 <[email protected]>
Signed-off-by: Andrzej Zaborowski <[email protected]>
hw/usb-net.c

index a8b7c8dd76953b10594612b50ba7693ed170ee29..f91fa32334afda33c1a5c5c73843767a95dfda43 100644 (file)
@@ -1268,8 +1268,9 @@ static ssize_t usbnet_receive(VLANClientState *nc, const uint8_t *buf, size_t si
 
     if (is_rndis(s)) {
         msg = (struct rndis_packet_msg_type *) s->in_buf;
-        if (!s->rndis_state == RNDIS_DATA_INITIALIZED)
+        if (s->rndis_state != RNDIS_DATA_INITIALIZED) {
             return -1;
+        }
         if (size + sizeof(struct rndis_packet_msg_type) > sizeof(s->in_buf))
             return -1;
 
@@ -1302,7 +1303,7 @@ static int usbnet_can_receive(VLANClientState *nc)
 {
     USBNetState *s = DO_UPCAST(NICState, nc, nc)->opaque;
 
-    if (is_rndis(s) && !s->rndis_state == RNDIS_DATA_INITIALIZED) {
+    if (is_rndis(s) && s->rndis_state != RNDIS_DATA_INITIALIZED) {
         return 1;
     }
 
This page took 0.02996 seconds and 4 git commands to generate.