summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_da_btree.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2019-02-07 21:45:45 +0300
committerDarrick J. Wong <darrick.wong@oracle.com>2019-02-12 03:07:01 +0300
commite34d3e74eb8f6eb020312cec747ff55ee1d1ca18 (patch)
tree2f30668dd9c418c55ffe64316c5da7785aa4cbe2 /fs/xfs/libxfs/xfs_da_btree.c
parent75d0230314997b18946c96dc3d93c8d61cfdb9a5 (diff)
downloadlinux-e34d3e74eb8f6eb020312cec747ff55ee1d1ca18.tar.xz
xfs: always check magic values in on-disk byte order
Most verifiers that check on-disk magic values convert the CPU endian magic value constant to disk endian to facilitate compile time optimization of the byte swap and reduce the need for runtime byte swaps in buffer verifiers. Several buffer verifiers do not follow this pattern. Update those verifiers for consistency. Also fix up a random typo in the inode readahead verifier name. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_da_btree.c')
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index 376bee94b5dd..355322688c9f 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -132,7 +132,7 @@ xfs_da3_node_verify(
if (xfs_sb_version_hascrc(&mp->m_sb)) {
struct xfs_da3_node_hdr *hdr3 = bp->b_addr;
- if (ichdr.magic != XFS_DA3_NODE_MAGIC)
+ if (hdr3->info.hdr.magic != cpu_to_be16(XFS_DA3_NODE_MAGIC))
return __this_address;
if (!uuid_equal(&hdr3->info.uuid, &mp->m_sb.sb_meta_uuid))
@@ -142,7 +142,7 @@ xfs_da3_node_verify(
if (!xfs_log_check_lsn(mp, be64_to_cpu(hdr3->info.lsn)))
return __this_address;
} else {
- if (ichdr.magic != XFS_DA_NODE_MAGIC)
+ if (hdr->hdr.info.magic != cpu_to_be16(XFS_DA_NODE_MAGIC))
return __this_address;
}
if (ichdr.level == 0)