xfs
[Top] [All Lists]

Re: [PATCH v2] xfs: check magic numbers in dir3 leaf verifier first

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH v2] xfs: check magic numbers in dir3 leaf verifier first
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Tue, 3 Sep 2013 00:33:12 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20130903000658.GJ12779@dastard>
References: <1378119020-31299-1-git-send-email-david@xxxxxxxxxxxxx> <20130903000658.GJ12779@dastard>
User-agent: Mutt/1.5.21 (2010-09-15)
> @@ -165,6 +165,7 @@ xfs_dir3_leaf_check_int(
>           (char *)&ents[hdr->count] > (char *)xfs_dir2_leaf_bests_p(ltp))
>               return false;
>  
> +
>       /* Check hash value order, count stale entries.  */

spurious new line..

>       if (xfs_sb_version_hascrc(&mp->m_sb)) {
>               struct xfs_dir3_leaf_hdr *leaf3 = bp->b_addr;
> +             __uint16_t              magic3;
>  
> +             magic3 = (magic == XFS_DIR2_LEAF1_MAGIC) ? XFS_DIR3_LEAF1_MAGIC
> +                                                      : XFS_DIR3_LEAFN_MAGIC;
>  
> +             if (leaf3->info.hdr.magic != cpu_to_be16(magic3))
> +                     return false;
>               if (!uuid_equal(&leaf3->info.uuid, &mp->m_sb.sb_uuid))
>                       return false;
>               if (be64_to_cpu(leaf3->info.blkno) != bp->b_bn)
>                       return false;
>       } else {
> -             if (leafhdr.magic != magic)
> +             if (leaf->hdr.info.magic != cpu_to_be16(magic))
>                       return false;
>       }

Looks good but I wonder if something like this should be factored into
a separate helper in the long run.


Reviewed-by: Christoph Hellwig <hch@xxxxxx>

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