From: Dan Carpenter <dan.carpenter@oracle.com>
To: Chris Mason <chris.mason@oracle.com>, Ilya Dryomov <idryomov@gmail.com>
Cc: linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] Btrfs: fix bitwise vs logical condition
Date: Fri, 20 Jan 2012 10:54:55 +0300 [thread overview]
Message-ID: <20120120075454.GA2295@elgon.mountain> (raw)
The intent here was to do a logical && instead of a bitwise &. The
original condition tests whether they have the some of same bits set.
I have fixed that and rewritten it to be more clear.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Warning: This is a static analysis bug and I'm not very familiar with
the code. Please review carefully.
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 0b4e2af..0c54027 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2376,8 +2376,8 @@ static int should_balance_chunk(struct btrfs_root *root,
u64 chunk_type = btrfs_chunk_type(leaf, chunk);
/* type filter */
- if (!((chunk_type & BTRFS_BLOCK_GROUP_TYPE_MASK) &
- (bctl->flags & BTRFS_BALANCE_TYPE_MASK))) {
+ if (!(chunk_type & BTRFS_BLOCK_GROUP_TYPE_MASK) ||
+ !(bctl->flags & BTRFS_BALANCE_TYPE_MASK)) {
return 0;
}
next reply other threads:[~2012-01-20 7:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 7:54 Dan Carpenter [this message]
2012-01-20 14:24 ` [patch] Btrfs: fix bitwise vs logical condition Ilya Dryomov
2012-01-20 15:21 ` Dan Carpenter
2012-01-20 16:00 ` Ilya Dryomov
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=20120120075454.GA2295@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=chris.mason@oracle.com \
--cc=idryomov@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.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).