From: Stefan Weil <sw@weilnetz.de>
To: Andrzej Zaborowski <balrogg@gmail.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH] Add 'fall through' comments to case statements without break
Date: Tue, 10 Jan 2012 22:52:27 +0100 [thread overview]
Message-ID: <4F0CB31B.107@weilnetz.de> (raw)
In-Reply-To: <20120110083555.GA13145@stefanha-thinkpad.localdomain>
Am 10.01.2012 09:35, schrieb Stefan Hajnoczi:
> This reminds me of another questionable fall-through:
>
> bt-host.c:bt_host_read():
>
> while (s->len --)
> switch (*pkt ++) {
> ...
> case HCI_SCODATA_PKT:
> if (s->len < 3)
> goto bad_pkt;
>
> pktlen = MIN(pkt[2] + 3, s->len);
> s->len -= pktlen;
> pkt += pktlen;
> <--- fall-through or not?
> default:
> bad_pkt:
> fprintf(stderr, "qemu: bad HCI packet type %02x\n", pkt[-1]);
> }
>
> It seems the code will skip HCI_SCODATA_PKT and report a warning
> (although type
> pkt[-1] will be incorrect). Any thoughts?
>
> Stefan
>
Hi Andrzej,
I think there should be a break statement at the end of the
HCI_SCODATA_PKT case. Could you please check this?
Regards,
Stefan
WARNING: multiple messages have this Message-ID (diff)
From: Stefan Weil <sw@weilnetz.de>
To: Andrzej Zaborowski <balrogg@gmail.com>
Cc: qemu-trivial@nongnu.org, Stefan Hajnoczi <stefanha@gmail.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] Add 'fall through' comments to case statements without break
Date: Tue, 10 Jan 2012 22:52:27 +0100 [thread overview]
Message-ID: <4F0CB31B.107@weilnetz.de> (raw)
In-Reply-To: <20120110083555.GA13145@stefanha-thinkpad.localdomain>
Am 10.01.2012 09:35, schrieb Stefan Hajnoczi:
> This reminds me of another questionable fall-through:
>
> bt-host.c:bt_host_read():
>
> while (s->len --)
> switch (*pkt ++) {
> ...
> case HCI_SCODATA_PKT:
> if (s->len < 3)
> goto bad_pkt;
>
> pktlen = MIN(pkt[2] + 3, s->len);
> s->len -= pktlen;
> pkt += pktlen;
> <--- fall-through or not?
> default:
> bad_pkt:
> fprintf(stderr, "qemu: bad HCI packet type %02x\n", pkt[-1]);
> }
>
> It seems the code will skip HCI_SCODATA_PKT and report a warning
> (although type
> pkt[-1] will be incorrect). Any thoughts?
>
> Stefan
>
Hi Andrzej,
I think there should be a break statement at the end of the
HCI_SCODATA_PKT case. Could you please check this?
Regards,
Stefan
next prev parent reply other threads:[~2012-01-10 21:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-09 17:29 [Qemu-trivial] [PATCH] Add 'fall through' comments to case statements without break Stefan Weil
2012-01-09 17:29 ` [Qemu-devel] " Stefan Weil
2012-01-09 17:34 ` [Qemu-trivial] " Peter Maydell
2012-01-09 17:34 ` Peter Maydell
2012-01-10 8:35 ` [Qemu-trivial] " Stefan Hajnoczi
2012-01-10 8:35 ` [Qemu-devel] " Stefan Hajnoczi
2012-01-10 21:52 ` Stefan Weil [this message]
2012-01-10 21:52 ` Stefan Weil
2012-01-12 13:05 ` [Qemu-trivial] [Qemu-devel] " andrzej zaborowski
2012-01-12 13:05 ` [Qemu-devel] [Qemu-trivial] " andrzej zaborowski
2012-01-12 13:16 ` [Qemu-trivial] [Qemu-devel] " Stefan Hajnoczi
2012-01-12 13:16 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2012-01-12 13:21 ` Stefan Hajnoczi
2012-01-12 13:21 ` [Qemu-devel] " Stefan Hajnoczi
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=4F0CB31B.107@weilnetz.de \
--to=sw@weilnetz.de \
--cc=balrogg@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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.