From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] Correct use of ! and &
Date: Thu, 26 Aug 2010 15:23:13 +0200 [thread overview]
Message-ID: <20100826132313.GA32336@edde.se.axis.com> (raw)
In-Reply-To: <AANLkTi=g3NHwzT6JuU30V0iBB906PHM5du7BsQY4qfT=@mail.gmail.com>
On Sat, Aug 21, 2010 at 09:42:51AM +0000, Blue Swirl wrote:
> Combining bitwise AND and logical NOT is suspicious.
>
> Fixed by this Coccinelle script:
> // From http://article.gmane.org/gmane.linux.kernel/646367
> @@ expression E1,E2; @@
> (
> !E1 & !E2
> |
> - !E1 & E2
> + !(E1 & E2)
> )
>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
>
> Maybe the middle hunk should be fixed this way instead:
> - } else if ((rw == 1) & !matching->d) {
> + } else if ((rw == 1) && !matching->d) {
>
> ---
> hw/etraxfs_eth.c | 2 +-
> target-sh4/helper.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/etraxfs_eth.c b/hw/etraxfs_eth.c
> index b897c9c..ade96f1 100644
> --- a/hw/etraxfs_eth.c
> +++ b/hw/etraxfs_eth.c
> @@ -464,7 +464,7 @@ static int eth_match_groupaddr(struct fs_eth *eth,
> const unsigned char *sa)
>
> /* First bit on the wire of a MAC address signals multicast or
> physical address. */
> - if (!m_individual && !sa[0] & 1)
> + if (!m_individual && !(sa[0] & 1))
> return 0;
Yep, the etrax part is a bug and your patch looks OK to me.
Thanks
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
next prev parent reply other threads:[~2010-08-26 13:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-21 9:42 [Qemu-devel] [PATCH] Correct use of ! and & Blue Swirl
2010-08-21 13:19 ` Markus Armbruster
2010-08-21 14:49 ` Blue Swirl
2010-08-26 13:23 ` Edgar E. Iglesias [this message]
2010-08-26 18:05 ` Blue Swirl
2010-08-27 9:03 ` Markus Armbruster
-- strict thread matches above, loose matches on Subject: below --
2011-01-14 22:05 Blue Swirl
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=20100826132313.GA32336@edde.se.axis.com \
--to=edgar.iglesias@gmail.com \
--cc=blauwirbel@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).