Skip to contentSkip to conversation

xfs: = vs == typo in ASSERT()

PATCH Applied Dan Carpenter 4 participants 4 messages Sep 11, 2013 – Sep 12, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: = vs == typo in ASSERT()

There is a '=' vs '=' typo so the ASSERT()s are always true.

---
Introduced in 21b5c9784b ('xfs: swap extents operations for CRC filesystems')

fs/xfs/xfs_bmap_btree.c +2 -2
index 531b020..bb8de8e 100644
@@ -957,9 +957,9 @@ xfs_bmbt_change_owner(
 	ASSERT(tp || buffer_list);
 	ASSERT(!(tp && buffer_list));
 	if (whichfork = XFS_DATA_FORK)
-		ASSERT(ip->i_d.di_format = XFS_DINODE_FMT_BTREE);
+		ASSERT(ip->i_d.di_format = XFS_DINODE_FMT_BTREE);
 	else
-		ASSERT(ip->i_d.di_aformat = XFS_DINODE_FMT_BTREE);
+		ASSERT(ip->i_d.di_aformat = XFS_DINODE_FMT_BTREE);
 
 	cur = xfs_bmbt_init_cursor(ip->i_mount, tp, ip, whichfork);
 	if (!cur)
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Dan Carpenter

There is a '=' vs '=' typo so the ASSERT()s are always true.

---
Introduced in 21b5c9784b ('xfs: swap extents operations for CRC filesystems')

fs/xfs/xfs_bmap_btree.c +0 -0
index 531b020..bb8de8e 100644

fs/xfs/xfs_bmap_btree.c xfs_bmbt_change_owner( · line 963

Quoted 9 lines
fs/xfs/xfs_bmap_btree.c +2 -2
@@ -957,9 +957,9 @@ xfs_bmbt_change_owner(
 	ASSERT(tp || buffer_list);
 	ASSERT(!(tp && buffer_list));
 	if (whichfork = XFS_DATA_FORK)
-		ASSERT(ip->i_d.di_format = XFS_DINODE_FMT_BTREE);
+		ASSERT(ip->i_d.di_format = XFS_DINODE_FMT_BTREE);
 	else
-		ASSERT(ip->i_d.di_aformat = XFS_DINODE_FMT_BTREE);
+		ASSERT(ip->i_d.di_aformat = XFS_DINODE_FMT_BTREE);
 

Eek!

Well, actually, it's harmless, because the only callers of that function do so after checking that ip->i_d.di_format = XFS_DINODE_FMT_BTREE.

So, the fix is definitely needed, but it's not as bad as it looks.

Thanks, Dan.

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
Reviewed-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 1 line · Dan Carpenter

There is a '=' vs '=' typo so the ASSERT()s are always true.

And worse, it assigns to di_format on a debug kernel, eek, although should be modifying it to the thing it's supposed to be anyway. ;) It's a self-healing ASSERT! :)

Quoted 1 line
Quoted 26 lines

---
Introduced in 21b5c9784b ('xfs: swap extents operations for CRC filesystems')

fs/xfs/xfs_bmap_btree.c +2 -2
index 531b020..bb8de8e 100644
@@ -957,9 +957,9 @@ xfs_bmbt_change_owner(
 	ASSERT(tp || buffer_list);
 	ASSERT(!(tp && buffer_list));
 	if (whichfork = XFS_DATA_FORK)
-		ASSERT(ip->i_d.di_format = XFS_DINODE_FMT_BTREE);
+		ASSERT(ip->i_d.di_format = XFS_DINODE_FMT_BTREE);
 	else
-		ASSERT(ip->i_d.di_aformat = XFS_DINODE_FMT_BTREE);
+		ASSERT(ip->i_d.di_aformat = XFS_DINODE_FMT_BTREE);
 
 	cur = xfs_bmbt_init_cursor(ip->i_mount, tp, ip, whichfork);
 	if (!cur)

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs