xfs
[Top] [All Lists]

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

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

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