[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] Btrfs: fix bitwise vs logical condition

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@xxxxxxxxxx>
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;
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Add to Google Powered by Linux