Re: [PATCH 02/16] xfs_repair: fix bogus rmapbt record owner check

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

 



On Fri, Nov 04, 2016 at 05:08:10PM -0700, Darrick J. Wong wrote:
> Make the reverse mapping owner check actually validate inode numbers.
> 
> Coverity-id: 1371628
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> ---
>  repair/scan.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/repair/scan.c b/repair/scan.c
> index 0e13581..b9ef4dc 100644
> --- a/repair/scan.c
> +++ b/repair/scan.c
> @@ -1052,8 +1052,12 @@ _("%s rmap btree block claimed (state %d), agno %d, bno %d, suspect %d\n"),
>  			}
>  
>  			/* Look for impossible owners. */
> -			if (!(owner > 0 || (owner > XFS_RMAP_OWN_MIN &&
> -					    owner <= XFS_RMAP_OWN_FS)))
> +			if (!((owner > XFS_RMAP_OWN_MIN &&
> +			       owner <= XFS_RMAP_OWN_FS) ||
> +			      (XFS_INO_TO_AGNO(mp, owner) < mp->m_sb.sb_agcount &&
> +			       XFS_AGINO_TO_AGBNO(mp,
> +					XFS_INO_TO_AGINO(mp, owner)) <
> +					mp->m_sb.sb_agblocks)))

This condition looks complex enough to break it out into a helper.


Except for that this looks fine:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux