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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux