From: Vlad Yasevich Date: Thu, 22 Jan 2009 22:52:23 +0000 (-0800) Subject: sctp: Fix crc32c calculations on big-endian arhes. X-Git-Tag: v2.6.28.6~34 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3d137641bbf5fcd5f45ceba31ea9f7d6f01fb22d;p=karo-tx-linux.git sctp: Fix crc32c calculations on big-endian arhes. [ Upstream commit 9c5ff5f75d0d0a1c7928ecfae3f38418b51a88e3 ] 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 Signed-off-by: Vlad Yasevich Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h index b799fb21519a..2fec3c366e81 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); }