[PATCH 4/4] xfs: fix sparse reported log CRC endian issue

Dave Chinner
2012-11-28T01:59:04Z

From: Dave Chinner <dchinner@redhat.com>

Not a bug as such, just warning noise from the xlog_cksum()
returning a __be32 type when it shoul dbe returning a __le32 type.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_log.c | 2 +-
fs/xfs/xfs_log_priv.h | 2 +-
fs/xfs/xfs_log_recover.c | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index c49e2c1..46bd9d5 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1538,7 +1538,7 @@ xlog_pack_data(
* This is a little more complicated than it should be because the various
* headers and the actual data are non-contiguous.
*/
-__be32
+__le32
xlog_cksum(
struct xlog *log,
struct xlog_rec_header *rhead,
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index dc3498b..16d8d12 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -555,7 +555,7 @@ extern int
xlog_recover_finish(
struct xlog *log);

-extern __be32 xlog_cksum(struct xlog *log, struct xlog_rec_header *rhead,
+extern __le32 xlog_cksum(struct xlog *log, struct xlog_rec_header *rhead,
char *dp, int size);

extern kmem_zone_t *xfs_log_ticket_zone;
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 9c3651c..96fcbb8 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3233,15 +3233,15 @@ xlog_unpack_data_crc(
xfs_caddr_t dp,
struct xlog *log)
{
- __be32 crc;
+ __le32 crc;

crc = xlog_cksum(log, rhead, dp, be32_to_cpu(rhead->h_len));
if (crc != rhead->h_crc) {
if (rhead->h_crc || xfs_sb_version_hascrc(&log->l_mp->m_sb)) {
xfs_alert(log->l_mp,
"log record CRC mismatch: found 0x%x, expected 0x%x.\n",
- be32_to_cpu(rhead->h_crc),
- be32_to_cpu(crc));
+ le32_to_cpu(rhead->h_crc),
+ le32_to_cpu(crc));
xfs_hex_dump(dp, 32);
}

--
1.7.10