[PATCH 1/4] sctp: Fix crc32c calculations on big-endian arhes.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Vlad Yasevich
Date: Thursday, January 22, 2009 - 3:36 pm

crc32c algorithm provides a byteswaped result.  On little-endian
arches, the result ends up in big-endian/network byte order.
On big-endinan arches, the result ends up in little-endian
order and needs to be byte swapped again.  Thus calling cpu_to_le32
gives the right output.

Tested-by: Jukka Taimisto <jukka.taimisto@mail.suomi.net>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
---
 include/net/sctp/checksum.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index b799fb2..2fec3c3 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -79,5 +79,5 @@ static inline __be32 sctp_update_cksum(__u8 *buffer, __u16 length, __be32 crc32)
 
 static inline __be32 sctp_end_cksum(__be32 crc32)
 {
-	return ~crc32;
+	return (__force __be32)~cpu_to_le32((__force u32)crc32);
 }
-- 
1.5.3.5

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] sctp: regression bug fixes, Vlad Yasevich, (Thu Jan 22, 3:36 pm)
[PATCH 1/4] sctp: Fix crc32c calculations on big-endian arhes., Vlad Yasevich, (Thu Jan 22, 3:36 pm)
Re: [PATCH] sctp: regression bug fixes, David Miller, (Thu Jan 22, 3:53 pm)