提交 e7852674 编写于 作者: P Peter Maydell 提交者: Andrzej Zaborowski

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: NPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: NAndrzej Zaborowski <andrew.zaborowski@intel.com>
上级 88365e47
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册