public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH 5/7] misc: fix Coverity errors
Date: Thu, 25 Aug 2016 02:14:52 -0700	[thread overview]
Message-ID: <20160825091452.GE5685@infradead.org> (raw)
In-Reply-To: <147200549633.15538.18051281375686885659.stgit@birch.djwong.org>

On Tue, Aug 23, 2016 at 07:24:56PM -0700, Darrick J. Wong wrote:
> Fix various code sloppinesses pointed out by Coverity.
> 
> Coverity-id: 1371628 - 1371638

> @@ -75,6 +75,7 @@ fsmap(
>  	high.rm_owner = ULLONG_MAX;
>  	high.rm_offset = ULLONG_MAX;
>  	high.rm_flags = XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK | XFS_RMAP_UNWRITTEN;
> +	high.rm_blockcount = low.rm_blockcount = 0;

Do the low initialization near the remaining low fields?

or better do a struct initialization ala

	struct xfs_rmap_irec low = { 0, };
	struct xfs_rmap_irec high = { 0, };

that ensures the who;le structure is zero-filled for uninitialized
fields.

> diff --git a/repair/phase5.c b/repair/phase5.c
> index e583879..5a7185c 100644
> --- a/repair/phase5.c
> +++ b/repair/phase5.c
> @@ -1464,7 +1464,7 @@ prop_rmap_cursor(
>  		 * and set the rightsib pointer of current block
>  		 */
>  #ifdef XR_BLD_INO_TRACE
> -		fprintf(stderr, " ino prop agbno %d ", lptr->prev_agbno);
> +		fprintf(stderr, " rmap prop agbno %d ", lptr->prev_agbno);
>  #endif

Did Coveryity really point this out? :)

> @@ -1548,6 +1548,7 @@ prop_rmap_highkey(
>  		bt_key->rm_offset = cpu_to_be64(
>  				libxfs_rmap_irec_offset_pack(&high_key));
>  
> +		key.rm_blockcount = 0;

should probably be a struct initializer again

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

  reply	other threads:[~2016-08-25  9:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-24  2:24 [PATCH 0/7] xfsprogs: reverse mapping fixes Darrick J. Wong
2016-08-24  2:24 ` [PATCH 1/7] xfs: don't perform lookups on zero-height btrees Darrick J. Wong
2016-08-25  9:11   ` Christoph Hellwig
2016-08-24  2:24 ` [PATCH 2/7] xfs: fix some key handling problems in _btree_simple_query_range Darrick J. Wong
2016-08-25  9:11   ` Christoph Hellwig
2016-08-24  2:24 ` [PATCH 3/7] xfs: simple btree query range should look right if LE lookup fails Darrick J. Wong
2016-08-25  9:11   ` Christoph Hellwig
2016-08-24  2:24 ` [PATCH 4/7] libxcmd: fix mount option parsing to find rt/log devices Darrick J. Wong
2016-08-25  9:12   ` Christoph Hellwig
2016-08-24  2:24 ` [PATCH 5/7] misc: fix Coverity errors Darrick J. Wong
2016-08-25  9:14   ` Christoph Hellwig [this message]
2016-08-25 16:30     ` Darrick J. Wong
2016-08-25 21:02   ` [PATCH v2 " Darrick J. Wong
2016-08-24  2:25 ` [PATCH 6/7] misc: fix libxfs api violations Darrick J. Wong
2016-08-24  2:25 ` [PATCH 7/7] xfs_repair: fix naming problems in repair/rmap.c Darrick J. Wong
2016-08-25 21:03 ` [PATCH 0/7] xfsprogs: reverse mapping fixes Darrick J. Wong

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=20160825091452.GE5685@infradead.org \
    --to=hch@infradead.org \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox