public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] XFS; xfs_trans_add_item() - don't assign in ASSERT() when compare is intended
@ 2012-02-13 20:51 Jesper Juhl
  2012-02-13 20:52 ` Jesper Juhl
  2012-02-13 21:10 ` Ben Myers
  0 siblings, 2 replies; 3+ messages in thread
From: Jesper Juhl @ 2012-02-13 20:51 UTC (permalink / raw)
  To: xfs; +Cc: xfs-masters, Ben Myers, Alex Elder, linux-kernel

It looks to me like the two ASSERT()s in xfs_trans_add_item() really
want to do a compare (==) rather than assignment (=).
This patch changes it from the former to the latter.

I must admit though, that I don't know this code well and have only
compile tested this change. But if assignment is really intended it
really seems strange to do it as part of an ASSERT...

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 fs/xfs/xfs_trans.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 329b06a..7adcdf1 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -1151,8 +1151,8 @@ xfs_trans_add_item(
 {
 	struct xfs_log_item_desc *lidp;
 
-	ASSERT(lip->li_mountp = tp->t_mountp);
-	ASSERT(lip->li_ailp = tp->t_mountp->m_ail);
+	ASSERT(lip->li_mountp == tp->t_mountp);
+	ASSERT(lip->li_ailp == tp->t_mountp->m_ail);
 
 	lidp = kmem_zone_zalloc(xfs_log_item_desc_zone, KM_SLEEP | KM_NOFS);
 
-- 
1.7.9


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

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

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

* Re: [PATCH] XFS; xfs_trans_add_item() - don't assign in ASSERT() when compare is intended
  2012-02-13 20:51 [PATCH] XFS; xfs_trans_add_item() - don't assign in ASSERT() when compare is intended Jesper Juhl
@ 2012-02-13 20:52 ` Jesper Juhl
  2012-02-13 21:10 ` Ben Myers
  1 sibling, 0 replies; 3+ messages in thread
From: Jesper Juhl @ 2012-02-13 20:52 UTC (permalink / raw)
  To: xfs; +Cc: xfs-masters, Ben Myers, Alex Elder, linux-kernel

On Mon, 13 Feb 2012, Jesper Juhl wrote:

> It looks to me like the two ASSERT()s in xfs_trans_add_item() really
> want to do a compare (==) rather than assignment (=).
> This patch changes it from the former to the latter.
> 
Ehh, I mean from the latter to the former, of course.. :-/

> I must admit though, that I don't know this code well and have only
> compile tested this change. But if assignment is really intended it
> really seems strange to do it as part of an ASSERT...
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>  fs/xfs/xfs_trans.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> index 329b06a..7adcdf1 100644
> --- a/fs/xfs/xfs_trans.c
> +++ b/fs/xfs/xfs_trans.c
> @@ -1151,8 +1151,8 @@ xfs_trans_add_item(
>  {
>  	struct xfs_log_item_desc *lidp;
>  
> -	ASSERT(lip->li_mountp = tp->t_mountp);
> -	ASSERT(lip->li_ailp = tp->t_mountp->m_ail);
> +	ASSERT(lip->li_mountp == tp->t_mountp);
> +	ASSERT(lip->li_ailp == tp->t_mountp->m_ail);
>  
>  	lidp = kmem_zone_zalloc(xfs_log_item_desc_zone, KM_SLEEP | KM_NOFS);
>  
> 

-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

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

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

* Re: [PATCH] XFS; xfs_trans_add_item() - don't assign in ASSERT() when compare is intended
  2012-02-13 20:51 [PATCH] XFS; xfs_trans_add_item() - don't assign in ASSERT() when compare is intended Jesper Juhl
  2012-02-13 20:52 ` Jesper Juhl
@ 2012-02-13 21:10 ` Ben Myers
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Myers @ 2012-02-13 21:10 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: xfs-masters, Alex Elder, linux-kernel, xfs

On Mon, Feb 13, 2012 at 09:51:05PM +0100, Jesper Juhl wrote:
> It looks to me like the two ASSERT()s in xfs_trans_add_item() really
> want to do a compare (==) rather than assignment (=).
> This patch changes it from the former to the latter.
                                 latter        former

I'll update your comment as you suggested.

> I must admit though, that I don't know this code well and have only
> compile tested this change. But if assignment is really intended it
> really seems strange to do it as part of an ASSERT...
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>  fs/xfs/xfs_trans.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> index 329b06a..7adcdf1 100644
> --- a/fs/xfs/xfs_trans.c
> +++ b/fs/xfs/xfs_trans.c
> @@ -1151,8 +1151,8 @@ xfs_trans_add_item(
>  {
>  	struct xfs_log_item_desc *lidp;
>  
> -	ASSERT(lip->li_mountp = tp->t_mountp);
> -	ASSERT(lip->li_ailp = tp->t_mountp->m_ail);
> +	ASSERT(lip->li_mountp == tp->t_mountp);
> +	ASSERT(lip->li_ailp == tp->t_mountp->m_ail);

Yeah, nice find...  ;)
Reviewed-by: Ben Myers <bpm@sgi.com>

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

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

end of thread, other threads:[~2012-02-13 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-13 20:51 [PATCH] XFS; xfs_trans_add_item() - don't assign in ASSERT() when compare is intended Jesper Juhl
2012-02-13 20:52 ` Jesper Juhl
2012-02-13 21:10 ` Ben Myers

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