xfs
[Top] [All Lists]

Re: [PATCH 5/7] misc: fix Coverity errors

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 5/7] misc: fix Coverity errors
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Thu, 25 Aug 2016 09:30:07 -0700
Cc: david@xxxxxxxxxxxxx, linux-xfs@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20160825091452.GE5685@xxxxxxxxxxxxx>
References: <147200546481.15538.12724000421579716885.stgit@xxxxxxxxxxxxxxxx> <147200549633.15538.18051281375686885659.stgit@xxxxxxxxxxxxxxxx> <20160825091452.GE5685@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.24 (2015-08-30)
On Thu, Aug 25, 2016 at 02:14:52AM -0700, Christoph Hellwig wrote:
> 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.

Ok.

> > 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? :)

Heh, nope.  I'll add it in the changelog.

> > @@ -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

<nod>

--D

<Prev in Thread] Current Thread [Next in Thread>