public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [patch] xfs: = vs == typo in ASSERT()
  2013-09-11 21:17 [patch] xfs: = vs == typo in ASSERT() Dan Carpenter
@ 2013-09-11  2:07 ` Dave Chinner
  2013-09-11 21:33 ` Eric Sandeen
  2013-09-12 14:50 ` Ben Myers
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Chinner @ 2013-09-11  2:07 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Ben Myers, Alex Elder, kernel-janitors, xfs

On Thu, Sep 12, 2013 at 12:17:31AM +0300, Dan Carpenter wrote:
> There is a '=' vs '==' typo so the ASSERT()s are always true.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Introduced in 21b5c9784b ('xfs: swap extents operations for CRC
> filesystems')
> 
> diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
> index 531b020..bb8de8e 100644
> --- a/fs/xfs/xfs_bmap_btree.c
> +++ b/fs/xfs/xfs_bmap_btree.c
> @@ -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.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

Thanks, Dan.

Cheers,

Dave.
-- 
Dave Chinner
dchinner@redhat.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch] xfs: = vs == typo in ASSERT()
@ 2013-09-11 21:17 Dan Carpenter
  2013-09-11  2:07 ` Dave Chinner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2013-09-11 21:17 UTC (permalink / raw)
  To: Ben Myers, Dave Chinner; +Cc: Alex Elder, kernel-janitors, xfs

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

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Introduced in 21b5c9784b ('xfs: swap extents operations for CRC
filesystems')

diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 531b020..bb8de8e 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] xfs: = vs == typo in ASSERT()
  2013-09-11 21:17 [patch] xfs: = vs == typo in ASSERT() Dan Carpenter
  2013-09-11  2:07 ` Dave Chinner
@ 2013-09-11 21:33 ` Eric Sandeen
  2013-09-12 14:50 ` Ben Myers
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Sandeen @ 2013-09-11 21:33 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Ben Myers, Alex Elder, kernel-janitors, xfs, Dave Chinner

On 9/11/13 4:17 PM, Dan Carpenter wrote:
> 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!  :)

> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
> Introduced in 21b5c9784b ('xfs: swap extents operations for CRC
> filesystems')
> 
> diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
> index 531b020..bb8de8e 100644
> --- a/fs/xfs/xfs_bmap_btree.c
> +++ b/fs/xfs/xfs_bmap_btree.c
> @@ -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
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] xfs: = vs == typo in ASSERT()
  2013-09-11 21:17 [patch] xfs: = vs == typo in ASSERT() Dan Carpenter
  2013-09-11  2:07 ` Dave Chinner
  2013-09-11 21:33 ` Eric Sandeen
@ 2013-09-12 14:50 ` Ben Myers
  2 siblings, 0 replies; 4+ messages in thread
From: Ben Myers @ 2013-09-12 14:50 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: xfs, Alex Elder, kernel-janitors, Dave Chinner

On Thu, Sep 12, 2013 at 12:17:31AM +0300, Dan Carpenter wrote:
> There is a '=' vs '==' typo so the ASSERT()s are always true.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-12 14:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-11 21:17 [patch] xfs: = vs == typo in ASSERT() Dan Carpenter
2013-09-11  2:07 ` Dave Chinner
2013-09-11 21:33 ` Eric Sandeen
2013-09-12 14:50 ` Ben Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox