All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Myers <bpm@sgi.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: xfs-masters@oss.sgi.com, Alex Elder <elder@kernel.org>,
	linux-kernel@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH] XFS; xfs_trans_add_item() - don't assign in ASSERT() when compare is intended
Date: Mon, 13 Feb 2012 15:10:27 -0600	[thread overview]
Message-ID: <20120213211027.GV8262@sgi.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1202132149270.16039@swampdragon.chaosbits.net>

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

WARNING: multiple messages have this Message-ID (diff)
From: Ben Myers <bpm@sgi.com>
To: Jesper Juhl <jj@chaosbits.net>
Cc: xfs@oss.sgi.com, xfs-masters@oss.sgi.com,
	linux-kernel@vger.kernel.org, Alex Elder <elder@kernel.org>
Subject: Re: [PATCH] XFS; xfs_trans_add_item() - don't assign in ASSERT() when compare is intended
Date: Mon, 13 Feb 2012 15:10:27 -0600	[thread overview]
Message-ID: <20120213211027.GV8262@sgi.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1202132149270.16039@swampdragon.chaosbits.net>

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>


  parent reply	other threads:[~2012-02-13 21:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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:51 ` Jesper Juhl
2012-02-13 20:52 ` Jesper Juhl
2012-02-13 20:52   ` Jesper Juhl
2012-02-13 21:10 ` Ben Myers [this message]
2012-02-13 21:10   ` Ben Myers

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=20120213211027.GV8262@sgi.com \
    --to=bpm@sgi.com \
    --cc=elder@kernel.org \
    --cc=jj@chaosbits.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xfs-masters@oss.sgi.com \
    --cc=xfs@oss.sgi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.