All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: patches@linaro.org, qemu-devel@nongnu.org,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] hw/usb-net.c: Fix precedence bug when checking rndis_state
Date: Mon, 12 Dec 2011 12:28:26 -0600	[thread overview]
Message-ID: <4EE647CA.5060909@codemonkey.ws> (raw)
In-Reply-To: <1320872963-10402-1-git-send-email-peter.maydell@linaro.org>

On 11/09/2011 03:09 PM, Peter Maydell wrote:
> "!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@linaro.org>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
> NB that although I tested that this doesn't break non-rndis
> usb-net, I don't have a test image that uses rndis usb-net,
> so treat this patch with the appropriate degree of caution.
> (Probably safer not putting it into 1.0 unless tested.)
>
>   hw/usb-net.c |    5 +++--
>   1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/hw/usb-net.c b/hw/usb-net.c
> index a8b7c8d..f91fa32 100644
> --- a/hw/usb-net.c
> +++ b/hw/usb-net.c
> @@ -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;
>       }
>

      parent reply	other threads:[~2011-12-12 18:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-09 21:09 [Qemu-devel] [PATCH] hw/usb-net.c: Fix precedence bug when checking rndis_state Peter Maydell
2011-11-14  3:00 ` andrzej zaborowski
2011-11-14  8:08   ` Peter Maydell
2011-11-14 17:21     ` andrzej zaborowski
2011-12-12 10:17       ` Peter Maydell
2011-12-12 18:28 ` Anthony Liguori [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EE647CA.5060909@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=kraxel@redhat.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.