All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Jeff Liu <jeff.liu@oracle.com>
Cc: "xfs@oss.sgi.com" <xfs@oss.sgi.com>
Subject: Re: Fwd: New Defects reported by Coverity Scan for xfsprogs
Date: Tue, 6 May 2014 19:16:02 +1000	[thread overview]
Message-ID: <20140506091602.GL5421@dastard> (raw)
In-Reply-To: <5368A578.7070201@oracle.com>

On Tue, May 06, 2014 at 05:03:52PM +0800, Jeff Liu wrote:
> Hi Folks,
> 
> I'm not sure if someone else has also noticed the following reports from Coverity.

yup, saw it - it not a regression from a recent checkin, so it must
some new check they've added to Coverity. However, i ignored it
because it looked completely bogus....

> It seems like a false alarm, but maybe we can just remove the out0 label as below?

Yup, it must be getting confused with the assignment of *stat = 0
after checking that it is already zero...

> From: Jie Liu <jeff.liu@oracle.com>
> Subject: xfs: get rid of out0 goto label from xfs_btree_new_root
> 
> Get rid of the useless out0 goto label and return 0 directly in case
> of falling to alloate the new block.
> 
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
> ---
>  fs/xfs/xfs_btree.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
> index 182bac2..f162dc9 100644
> --- a/fs/xfs/xfs_btree.c
> +++ b/fs/xfs/xfs_btree.c
> @@ -2653,8 +2653,11 @@ xfs_btree_new_root(
>  	error = cur->bc_ops->alloc_block(cur, &rptr, &lptr, stat);
>  	if (error)
>  		goto error0;
> -	if (*stat == 0)
> -		goto out0;
> +	if (*stat == 0) {
> +		XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT);
> +		return 0;
> +	}
> +
>  	XFS_BTREE_STATS_INC(cur, alloc);
>  
>  	/* Set up the new block. */
> @@ -2743,10 +2746,6 @@ xfs_btree_new_root(
>  error0:
>  	XFS_BTREE_TRACE_CURSOR(cur, XBT_ERROR);
>  	return error;
> -out0:
> -	XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT);
> -	*stat = 0;
> -	return 0;
>  }

Looks fine. It's not obviously a problem, so I'll queue it up for
after then 3.2.0 release.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

      reply	other threads:[~2014-05-06  9:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5362fbfc78ad5_2dbacf387045986@209.249.196.67.mail>
2014-05-06  9:03 ` Fwd: New Defects reported by Coverity Scan for xfsprogs Jeff Liu
2014-05-06  9:16   ` Dave Chinner [this message]

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=20140506091602.GL5421@dastard \
    --to=david@fromorbit.com \
    --cc=jeff.liu@oracle.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.