summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_sb.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2019-02-07 19:45:45 +0100
committerDarrick J. Wong <darrick.wong@oracle.com>2019-02-12 01:07:01 +0100
commite34d3e74eb8f6eb020312cec747ff55ee1d1ca18 (patch)
tree2f30668dd9c418c55ffe64316c5da7785aa4cbe2 /fs/xfs/libxfs/xfs_sb.c
parentxfs: clarify documentation for the function to reverify buffers (diff)
downloadlinux-e34d3e74eb8f6eb020312cec747ff55ee1d1ca18.tar.xz
linux-e34d3e74eb8f6eb020312cec747ff55ee1d1ca18.zip
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 '')
-rw-r--r--fs/xfs/libxfs/xfs_sb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index b5a82acd7dfe..a2f52a958091 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -225,10 +225,11 @@ xfs_validate_sb_common(
struct xfs_buf *bp,
struct xfs_sb *sbp)
{
+ struct xfs_dsb *dsb = XFS_BUF_TO_SBP(bp);
uint32_t agcount = 0;
uint32_t rem;
- if (sbp->sb_magicnum != XFS_SB_MAGIC) {
+ if (dsb->sb_magicnum != cpu_to_be32(XFS_SB_MAGIC)) {
xfs_warn(mp, "bad magic number");
return -EWRONGFS;
}